/*
 * Modified By Basha (09th JULY 2003)
*/

package com.scalar.chiptrack.sales;

import com.scalar.ScalarException;
import com.scalar.chiptrack.commons.Address;
import com.scalar.chiptrack.commons.Labels;
import com.scalar.chiptrack.commons.Constants;
import com.scalar.chiptrack.sales.dao.quote.QuotationDAO;
import com.scalar.chiptrack.utils.ConfigManager;
import com.scalar.chiptrack.utils.Mailer;
import com.scalar.chiptrack.utils.StringUtils;
import com.scalar.chiptrack.utils.AutoGrowingArrayList;

import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.HashMap;
import java.lang.NullPointerException;

import org.apache.struts.util.MessageResources;
import org.apache.struts.upload.FormFile;


public class Quotation {

    private static final String QUOTE_URI_1         = "/approveQuotation.do?quotationId=";
    private static final String SALES_ORDER_URI_2   = "/viewOrders.do?quotationId=";
    private static final String USER_PROFILE_URI    = "userProfile.do";

    private int quotationId             = -1;
    private int customerId              = -1;
    private int billingAddressId        = -1;
    private int shippingAddressId       = -1;
    private int alaramId                = -1;
    private int revision                = 0;
    private int odmId                   = -1;
    private int shippingInstructionsId  = -1;
    private int freightInstructionsId   = -1;
    private int endCustomerId           = -1;

    private float salesTaxValue = 0f;
    private float subTotal      = 0.0f;
    private float salesTax      = 0.0f;
    private float frieght       = 0.0f;
    private float misc          = 0.0f;
    private float orderTotal    = 0.0f;

    double subTotalAsDouble   = 0.0;
	double salesTaxAsDouble   = 0.0;
	double frieghtAsDouble    = 0.0;
	double miscAsDouble       = 0.0;
	double orderTotalAsDouble = 0.0;

    private double finalSubTotal    = 0.0f;
    private double finalSalesTax    = 0.0f;
    private double finalOrderTotal  = 0.0f;

    private String quotationNo          = null;
    private String customerName         = null;
    private String customerPo           = null;
    private String contactPerson        = null;
    private String salesPerson          = null;
    private String phoneNumber          = null;
    private String faxNumber            = null;
    private String email                = null;
    private String endUser              = null;
    private String shippingMethod       = null;
    private String shippingAccount      = null;
    private String billingAddress       = null;
    private String shippingAddress      = null;
    private String comments             = null;
    private String shippingInstructions = null;
    private String status               = null;
    private String enteredById          = null;
    private String enteredByName        = null;
    private String enteredDate          = null;
    private String shippingMethodName   = null;
    private String reason               = null;
    private String quotationDate        = null;
    private String expiryDate           = null;
    private String action               = null;
    private String status_temp          = null;
    public  String clientName           = null;
    private String billingContactPerson = null;
    private String shippingContactPerson= null;
    private String cellNumber           = null;
    private String newShippingTerms     = null;
    private String salesRep             = null;
    private String poRev                = null;
    private String poDate               = null;
    private String odm                  = null;
    private String endUserId            = null;
    private String freightInstructions  = null;
    private String salesOrderQuoteNo    = null;
    private String endCustomer          = null;
    private String salesTaxType         = null;
    private String miscName             = "Misc";

    private String newShippingMethod    = null;
    private String regionalRep          = null;
    private String shippingTerms        = null;
    private String deliveryTerms        = "EXW";
    private String clientAddress        = null;
    private String clientAddressAsHTML  = "";

    private static String totalQty      = null;
    private static String totalAmount   = null;

    private ArrayList contactPersonsForBillingAddress   = null;
    private ArrayList contactPersonsForShippingAddress  = null;
    private ArrayList shippingMethods       = null;
    private ArrayList shippingAddresses     = null;
    private ArrayList contactPersons        = null;
    private ArrayList allShippingTerms      = null;
    private ArrayList allDeliveryTerms      = null;
    private ArrayList mfgParts              = null;
    private ArrayList salesPersons          = null;
    private ArrayList salesReps             = null;
    private ArrayList odmList               = null;
    private ArrayList changedLineItems      = null;
    private ArrayList prvApprovedLineItems  = null;
    private ArrayList endCustomerList       = null;


    private boolean isCancel                = false;
    private boolean isSample                = false;
    private boolean isPending               = false;
    private boolean isShipped               = false;
    private boolean sales_order_status      = false;
    private boolean isEndCustomerShipAddress= false;
    private boolean isApproved              = false;

    private Date bookingDate                    = null;
    private HashMap billingAddressMap           = null;
    private HashMap shippingAddressMap          = null;
    private HashMap customerContactPersonMap    = null;
    private HashMap mfgPartsWithComments        = null;
    private HashMap mfgPartsWithBaseOrderQty    = null;
    private HashMap mfgPartsWithCustomerPartNos = null;
    private HashMap mfgPartsWithLabelNumbers    = null;
    private Address clientAddressAsObject       = new Address();
    private Address billingAddressAsObject      = new Address();
    private Address shippingAddressAsObject     = null;
    private boolean isDistributor;
    private String quoteType;
    private String application;
    private String addNewApplication;
    private String newEndUserName;
    private String newEndCustomerName;
    private String expectedPoDate = null;

    private ArrayList quotationQuestionnairyList  = new AutoGrowingArrayList(QuotationQuestionnairy.class);

     private String  quotationType		= null;
     private float   currentPrice		= 0.0f;
     private int     currentPriceUnits	= 0;
     private String  currentPriceUnitsType = null;
     private String  currentPriceOthers	= null;
     private float   targetPrice		    = 0.0f;
     private String  targetPriceUnitsType = null;
     private int     targetPriceUnits	= 0;
     private String  targetPriceOthers	= null;
     private String  historyPricesInfo		= null;
     private boolean contractPriceFlag	    = false;
     private FormFile contractPriceFilePath	= null;
     private String  contractPriceFileName	= null;
     private String  contractPriceFileNamePath	= null;
     private String  contractPriceChangedReason  = null;
     private String  previousCommitments	        = null;
     private String  previousCommitmentsPrice	    = null;
     private String  commitmentAddtionalInfo	    = null;
     private boolean previousQuotation	= false;
     private String  previousQuotationDetails= null;
     private String[]  priceDiscountReason	    = null;
     private String  priceDiscountComments	= null;
     private boolean rebate     = false;
     private float  rebateValue		    = 0.0f;
     private String rebateOpertunity	= null;
     private String rebateGoal		    = null;
     private String rebateTarget		= null;
     private float  rebateTargetValue	= 0.0f;
     private String rebateVerifiedBy	= null;
     private String competatior1		    = null;
     private String competatior1Others	    = null;
     private float  competatior1Price	    = 0.0f;
     private String competatior1PriceUnit	= null;
     private String competatior1Comments	= null;
     private String competatior2		    = null;
     private String competatior2Others	    = null;
     private float  competatior2Price	    = 0.0f;
     private String competatior2PriceUnit	= null;
     private String competatior2Comments	= null;
     private float  distributorMargin	    = 0.0f;
     private float  marginDollars		    = 0.0f;
     private String totalPrevMargins	    = null;
     private String marginReason		    = null;
     private String prevQuotationNo         = null;
     private String currentPriceUnitsString  =  null;
     private String targetPriceUnitsString    = null;
     private String competatior1PriceUnitsType = null;
     private String competatior2PriceUnitsType = null;
     private String competatior1PriceUnitOthers = null;
     private String competatior2PriceUnitOthers = null;
     private String rebateTargetGoalTimeFrame   = null;
     private String rebateTargetGoalTimeFrameOthers = null;
     private String competatior1PriceUnitString = null;
     private String competatior2PriceUnitString = null;    
     private ArrayList previousQuotationDetailsList  = new AutoGrowingArrayList(PreviousQuotationDetails.class);
     private ArrayList previousQuotationPriceDetailsList  = new AutoGrowingArrayList(PreviousQuotationDetails.class);
    private String projectName = null;
    private String opportunityId = null;

    public Quotation() { }

    public Quotation(int quotationId, int customerId,String customerPo, String contactPerson, String salesPerson, String shippingMethod, String shippingAccount, int billingAddressId, int shippingAddressId, String comments, String shippingInstructions, String endUser, java.util.Date bookingDate, boolean isSample )
    {
        this.quotationId = quotationId;
        this.customerId = customerId;
        this.customerPo = customerPo;
        this.contactPerson = contactPerson;
        this.salesPerson = salesPerson;
        this.shippingMethod = shippingMethod;
        this.shippingAccount = shippingAccount;
        this.billingAddressId = billingAddressId;
        this.shippingAddressId = shippingAddressId;
        this.comments = comments;
        this.shippingInstructions = shippingInstructions;
        this.endUser = endUser;
        this.bookingDate = bookingDate;
        this.quotationDate = StringUtils.formatDateToString(bookingDate);
        this.isSample = isSample;
    }

    public int getQuotationId()
    {
        return quotationId;
    }

    public void setQuotationId(int quotationId)
    {
        this.quotationId = quotationId;
    }

	public String getQuotationNo()
    {
        return quotationNo;
    }

    public void setQuotationNo(String quotationNo)
    {
        this.quotationNo = quotationNo;
    }

    public int getCustomerId()
    {
        return customerId;
    }

    public void setCustomerId(int customerId)
    {
        this.customerId = customerId;
    }

    public String getCustomerName()
    {
        return customerName;
    }

    public void setCustomerName(String customerName)
    {
        this.customerName = customerName;
    }

    public String getCustomerPO()
    {
        return customerPo;
    }

    public void setCustomerPO(String customerPo)
    {
        this.customerPo = customerPo;
    }

    public String getContactPerson()
    {
        return contactPerson;
    }

    public void setContactPerson(String contactPerson)
    {
        this.contactPerson = contactPerson;
    }

    public String getSalesPerson()
    {
        if(salesPerson == null)
            salesPerson = " ";
        if( salesPerson != null ){
            salesPerson = salesPerson.trim() ;
        }
        return salesPerson;
    }

    public void setSalesPerson(String salesPerson)
    {
        if( salesPerson != null ){
            salesPerson = salesPerson.trim() ;
        }
        this.salesPerson = salesPerson;
    }

    public String getSalesRep()
    {
        if(salesRep == null)
            salesRep = "";
        return salesRep;
    }

    public void setSalesRep(String salesRep)
    {
        this.salesRep = salesRep;
    }

    public String getPhoneNumber()
    {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber)
    {
        this.phoneNumber = phoneNumber;
    }

    public String getFaxNumber()
    {
        return faxNumber;
    }

    public void setFaxNumber(String faxNumber)
    {
        this.faxNumber = faxNumber;
    }

    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    public String getEndUser()
    {
        return endUser;
    }

    public void setEndUser(String endUser)
    {
        this.endUser = endUser;
    }

    public String getShippingMethod()
    {
		String finalShippingMethod = "";
        if( shippingMethod != null &&  shippingMethod.trim().length() == 0)
	    {
		    finalShippingMethod = "";
	    }
	    else
	    {
		    finalShippingMethod = shippingMethod+"   #   "+shippingAccount;
	    }
        return finalShippingMethod;
    }

    public void setShippingMethod(String shippingMethod)
    {
        this.shippingMethod = shippingMethod;
    }

    public String getShippingAccount()
    {
        return shippingAccount;
    }

    public void setShippingAccount(String shippingAccount)
    {
        this.shippingAccount = shippingAccount;
    }

    public ArrayList getShippingMethods()
    {
        return shippingMethods;
    }

    public void setShippingMethods(ArrayList shippingMethods)
    {
        this.shippingMethods = shippingMethods;
    }

    public ArrayList getShippingAddresses()
    {
        return shippingAddresses;
    }

    public void setShippingAddresses(ArrayList shippingAddresses)
    {
        this.shippingAddresses = shippingAddresses;
    }

    public int getBillingAddressId()
    {
        return billingAddressId;
    }

    public void setBillingAddressId(int billingAddressId)
    {
        this.billingAddressId = billingAddressId;
    }

    public String getBillingAddress()
    {
        return billingAddress;
    }

    public void setBillingAddress(String billingAddress)
    {
        this.billingAddress = billingAddress;
    }

    public int getShippingAddressId()
    {
        return shippingAddressId;
    }

    public void setShippingAddressId(int shippingAddressId)
    {
        this.shippingAddressId = shippingAddressId;
    }

    public String getShippingAddress()
    {
        return shippingAddress;
    }

    public void setShippingAddress(String shippingAddress)
    {
        this.shippingAddress = shippingAddress;
    }

    public String getComments()
    {
        return comments;
    }

    public void setComments(String comments)
    {
        this.comments = comments;
    }

    public String getShippingInstructions()
    {
        return shippingInstructions;
    }

    public void setShippingInstructions(String shippingInstructions)
    {
        this.shippingInstructions = shippingInstructions;
    }

    public boolean isCancel()
    {
        return isCancel;
    }

    public void setIsCancel(boolean isCancel)
    {
        this.isCancel = isCancel;
    }

    public String getStatus()
    {
        return status;
    }

    public void setStatus(String status)
    {
        this.status = status;
    }

    public boolean getIsSample()
    {
        return isSample;
    }

    public void setIsSample(boolean isSample)
    {
        this.isSample = isSample;
    }

    public boolean isShipped()
    {
        return isShipped;
    }

    public void setIsShipped(boolean isShipped)
    {
        this.isShipped = isShipped;
    }

    public boolean isPending()
    {
        return isPending;
    }

    public void setIsPending(boolean isPending)
    {
        this.isPending = isPending;
    }

    public int getAlaramId()
    {
        return alaramId;
    }

    public void setAlaramId(int alaramId)
    {
        this.alaramId = alaramId;
    }

    public String getBookingdateAsString()
    {
        return (StringUtils.formatDateToString(bookingDate,null));
    }
    public java.util.Date getBookingDate()
    {
        return bookingDate;
    }

    public void setBookingDate(java.util.Date bookingDate)
    {
        this.bookingDate = bookingDate;
    }

    public String getEnteredById()
    {
        return enteredById;
    }

    public void setEnteredById(String enteredById)
    {
        this.enteredById = enteredById;
    }

    public String getEnteredByName()
    {
        return enteredByName;
    }

    public void setEnteredByName(String enteredByName)
    {
        this.enteredByName = enteredByName;
    }

    public String getShippingMethodName()
    {
        int index1 = 0;
        if(shippingMethodName !=  null)
        {
            index1 = shippingMethodName.indexOf(" # ");
            if( index1 != -1 && index1 != 0)
            {
                shippingMethodName = shippingMethodName.substring(0,index1);
            }
        }
        return shippingMethodName;
    }

    public void setShippingMethodName(String shippingMethodName)
    {
        this.shippingMethodName = shippingMethodName;
    }

    public String getReason()
    {
        return reason;
    }

    public void setReason(String reason)
    {
        this.reason = reason;
    }

    public String getEnteredDate()
    {
        return this.enteredDate;
    }

    public void setEnteredDate (String date)
    {
        this.enteredDate = date;
    }


    public String getQuotationDate()
    {
        return quotationDate;
    }

    public void setQuotationDate(String quotationDate)
    {
        this.quotationDate = quotationDate;
    }


    public String getExpiryDate()
    {
        return expiryDate;
    }

    public void setExpiryDate(String expiryDate)
    {
        this.expiryDate = expiryDate;
    }

    public ArrayList getContactPersons() {
        return contactPersons;
    }

    public void setContactPersons(ArrayList contactPersons) {
        this.contactPersons = contactPersons;
    }
    public ArrayList getContactPersonsForBillingAddress() {
        return contactPersonsForBillingAddress;
    }

    public void setContactPersonsForBillingAddress(ArrayList contactPersonsForBillingAddress) {
         this.contactPersonsForBillingAddress = contactPersonsForBillingAddress;
    }

    public ArrayList getContactPersonsForShippingAddress() {
        return contactPersonsForShippingAddress;
    }

    public void setContactPersonsForShippingAddress(ArrayList contactPersonsForShippingAddress) {
        this.contactPersonsForShippingAddress = contactPersonsForShippingAddress;
    }

    public String getBillingContactPerson() {
         return billingContactPerson;
    }

    public void setBillingContactPerson(String billingContactPerson) {
        this.billingContactPerson = billingContactPerson;
    }

    public String getShippingContactPerson() {
        return shippingContactPerson;
    }

    public void setShippingContactPerson(String shippingContactPerson) {
        this.shippingContactPerson = shippingContactPerson;
    }
     public ArrayList getAllShippingTerms() {
        return allShippingTerms;
    }

    public void setAllShippingTerms(ArrayList allShippingTerms) {
        this.allShippingTerms = allShippingTerms;
    }
     public String getCellNumber() {
        return cellNumber;
    }

    public void setCellNumber(String cellNumber) {
        this.cellNumber = cellNumber;
    }
    private String billingAddressAsHTML="";
    public String getBillingAddressAsHTML()
    {
        StringBuffer tempAddress=new StringBuffer("");
        for(int i=0;i<billingAddress.length();i++)
        {
            char ch = billingAddress.charAt(i);
            if(ch=='\n')
            {
                tempAddress.append("<br>");
            }
            else
            {
                tempAddress.append(ch);
            }
        }
        billingAddressAsHTML = tempAddress.toString();
        return billingAddressAsHTML;
    }
    private String shippingAddressAsHTML="";
    public String getShippingAddressAsHTML()
    {
       StringBuffer tempAddress=new StringBuffer("");
       if ( shippingAddress != null )
       {
           for(int i=0;i<shippingAddress.length();i++)
           {
               char ch = shippingAddress.charAt(i);
               if(ch=='\n')
               {
                   tempAddress.append("<br>");
               }
               else
               {
                   tempAddress.append(ch);
               }
           }
       }
       shippingAddressAsHTML = tempAddress.toString();
       return shippingAddressAsHTML;
    }
    public String getNewShippingTerms() {
        return newShippingTerms;
    }

    public void setNewShippingTerms(String newShippingTerms) {
        this.newShippingTerms = newShippingTerms;
    }

    public static String getHtmlView (int quotationId) throws ScalarException
    {
        Quotation quotation = QuotationDAO.loadQuotation (quotationId+"", false);
        return quotation.getHtmlView();
    }


    public String getHtmlView() throws ScalarException
    {
        Quotation quotation = this;

        ArrayList presentLineItems = QuotationDAO.loadOrderLineItemsWithCustomerPartNo ( quotation.getQuotationId (), quotation.getCustomerId () );
        if (presentLineItems == null) presentLineItems = new ArrayList();

        boolean isClientAirgo = false;
        String endUserLabel = null;
        String endCustomerLabel = null;
        String poRevLabel = null;
        String poDateLabel = null;
        String poNoLabel = null;
        String representativeLabel = null;
        String shippingMethodLabel = null;
        String shippingAccountLabel = null;
        String deliveryTermsLabel = null;
        String mfgPartNumberLabel = null;
        String customerPartNumberLabel = null;
        String labelNumberLabel = null;

        try
        {
            endCustomerLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.endCustomer" );
            if ( endCustomerLabel == null )
            {
                endCustomerLabel = Labels.DEFAULT_END_CUSTOMER_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            endCustomerLabel    = Labels.DEFAULT_END_CUSTOMER_LABEL;
        }
        try
        {
            endUserLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.endUser" );
            if ( endUserLabel == null )
            {
                endUserLabel = Labels.DEFAULT_END_USER_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            endUserLabel    = Labels.DEFAULT_END_CUSTOMER_LABEL;
        }
        try
        {
            poRevLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.PoRevisionNumber" );
            if ( poRevLabel == null )
            {
                poRevLabel = Labels.DEFAULT_PO_REV;
            }
        }
        catch ( NullPointerException e )
        {
            poRevLabel = Labels.DEFAULT_PO_REV;
        }
        try
        {
            poDateLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.PoDate" );
            if ( poDateLabel == null )
            {
                poDateLabel = Labels.DEFAULT_PO_DATE;
            }
        }
        catch ( NullPointerException e )
        {
            poDateLabel = Labels.DEFAULT_PO_DATE;
        }
        try
        {
            poNoLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.PoNumber" );
            if ( poNoLabel == null )
            {
                poNoLabel = Labels.DEFAULT_PO_NO;
            }
        }
        catch ( NullPointerException e )
        {
            poNoLabel = Labels.DEFAULT_PO_NO;
        }
        try
        {
            representativeLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesRep.Name" );
            if ( representativeLabel == null )
            {
                representativeLabel = Labels.DEFAULT_REPRESENTATIVE;
            }
        }
        catch ( NullPointerException e )
        {
            representativeLabel = Labels.DEFAULT_REPRESENTATIVE;
        }
        try
        {
            shippingMethodLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.ShippingMethod" );
            if ( shippingMethodLabel == null )
            {
                shippingMethodLabel = Labels.DEFAULT_SHIPPING_METHOD_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            shippingMethodLabel    = Labels.DEFAULT_SHIPPING_METHOD_LABEL;
        }
        try
        {
            shippingAccountLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.ShippingAccount" );
            if ( shippingAccountLabel == null )
            {
                shippingAccountLabel = Labels.DEFAULT_SHIPPING_ACCOUNT_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            shippingAccountLabel = Labels.DEFAULT_SHIPPING_ACCOUNT_LABEL;
        }
        try
        {
            deliveryTermsLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.DeliveryTerms" );
            if ( deliveryTermsLabel == null )
            {
                deliveryTermsLabel = Labels.DEFAULT_DELIVERY_TERMS_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            deliveryTermsLabel    = Labels.DEFAULT_DELIVERY_TERMS_LABEL;
        }
        try
        {
            mfgPartNumberLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.mfgPartNumber" );
            if ( mfgPartNumberLabel == null )
            {
                mfgPartNumberLabel = Labels.DEFAULT_MFG_PART_NUMBER_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            mfgPartNumberLabel  = Labels.DEFAULT_MFG_PART_NUMBER_LABEL;
        }
        try
        {
            customerPartNumberLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.customerPartNumber" );
            if ( customerPartNumberLabel == null )
            {
                customerPartNumberLabel = Labels.DEFAULT_CUSTOMER_PART_NUMBER_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            customerPartNumberLabel  = Labels.DEFAULT_CUSTOMER_PART_NUMBER_LABEL;
        }
        try
        {
            labelNumberLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.labelNumber" );
            if ( labelNumberLabel == null )
            {
                labelNumberLabel = Labels.DEFAULT_LABEL_NUMBER_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            labelNumberLabel  = Labels.DEFAULT_LABEL_NUMBER_LABEL;
        }
        if ( Constants.CLIENT_NAME_AIRGO.equalsIgnoreCase(ConfigManager.getClientNameAirgo() ) ) {
            isClientAirgo = true;
        }
        String requestedPriceLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.requestedPrice" );
        if ( requestedPriceLabel == null )
        {
            requestedPriceLabel = Labels.DEFAULT_REQUESTED_PRICE_LABEL;
        }
        String custResalePriceLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.customerResalePrice" );
        if ( custResalePriceLabel == null )
        {
            custResalePriceLabel = Labels.DEFAULT_CUST_RESALE_PRICE_LABEL;
        }
        String priceLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.price" );
        if ( priceLabel == null )
        {
            priceLabel = Labels.DEFAULT_PRICE_LABEL;
        }
        String suggResalePriceLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.suggestedResalePrice" );
        if ( suggResalePriceLabel == null )
        {
            suggResalePriceLabel = Labels.DEFAULT_SUGG_RESALE_PRICE_LABEL;
        }
        // NOW WE HAVE ALL THE VALUES REQUIRED -- BUILD THE HTML PAGE
        StringBuffer htmlView = new StringBuffer();

        htmlView.append ("<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE><META http-equiv=Content-Type content='text/html; charset=windows-1252'>\n");

        htmlView.append ("<style type=\"text/css\">");
        htmlView.append ("#toc a{ font-family: Verdana;font-style : normal ;font-size : 7pt; font-weight :bold;}");
        htmlView.append ("#toc p{font-family: Verdana;font-style : normal ;font-size : 7pt; font-weight :bold;text-align :center;color :#FFFFFF}");
        htmlView.append ("#toc {border-style : solid;border-color :#000000 ;border-width :medium }");
        htmlView.append ("</style></head>\n");


        htmlView.append ("<BODY bgColor='#ffffff' leftMargin=0 topMargin=0 marginheight='0' marginwidth='0' ><br>\n");

        htmlView.append ("<TABLE cellSpacing=0 cellPadding=0 width='100%' border=1 bgcolor='#FFFFFF' align='center' style='FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana'><tr><td>\n");
        htmlView.append ("<table cellSpacing=0 cellPadding=3 width='100%' border=0 bgcolor='#FFFFFF' align='center' style='FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana'>\n");
        htmlView.append ("<tr><td colspan='6' align='center'><br></td></tr>\n");
        htmlView.append ("<tr><td colspan='6' bgcolor='#ccccff' valign='center' align='center'><SPAN style='FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana'><strong>Quote</strong></span></td></tr>\n");

        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'>Created By:</font></td>\n");
 	    htmlView.append ("<td width='21%' class='bodytext'>" + ((quotation.getEnteredById() == null) ? "" : quotation.getEnteredById()) + "</td>\n");
 	    htmlView.append ("<td width='3%'>&nbsp;</td><td width='21%'>Last Updated On:</font></td>\n");
 	    htmlView.append ("<td width='21%' class='bodytext'>" + ((quotation.getEnteredDate() == null) ? "" : quotation.getEnteredDate()) + "</td>\n");

        htmlView.append ("<td width='3%'>&nbsp;</td></tr><tr bgColor='#e6e6e6'><td colspan='6' align='center'><br></td></tr>\n");
        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'><font class='NArialL'>Quote No :</font></td>\n");
	    htmlView.append ("<td width='21%' class='bodytext'><b>" + quotation.getQuotationNo() + "</b></td>\n");
        htmlView.append ("<td width='3%'>&nbsp;</td><td width='21%'>Customer Name :</font></td>");
	    htmlView.append ("<td width='21%' class='bodytext'>" + quotation.getCustomerName() + "</td>");

        htmlView.append ("<td width='3%'>&nbsp;</td></tr><tr bgColor='#e6e6e6'><td width='21%'>"+poRevLabel+ " :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getPoRev() == null) ? "" : quotation.getPoRev()) + "</font></td><td width='3%'>&nbsp;</td>\n");
        htmlView.append ("<td width='21%'>"+poDateLabel+ ":</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getPoDate() == null) ? "" : quotation.getPoDate()) + "</font></td><td width='3%'>&nbsp;</td></tr>\n");

        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'>"+poNoLabel+" :</font></td>\n");
	    htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getCustomerPO() == null) ? "" : quotation.getCustomerPO()) + "</font></td><td width='3%'>&nbsp;</td>\n");
	    htmlView.append ("<td width='21%'>Contact Person :</font></td>\n");
	    htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getContactPerson() == null) ? "" : quotation.getContactPerson()) + "</font></td><td width='3%'>&nbsp;</td></tr>\n");

        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'>Phone No :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getPhoneNumber() == null) ? "" : quotation.getPhoneNumber()) + "</font></td><td width='3%'>&nbsp;</td>\n");
        htmlView.append ("<td width='21%'>Cell No :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getCellNumber() == null) ? "" : quotation.getCellNumber()) + "</font></td><td width='3%'>&nbsp;</td></tr>\n");

        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'>Fax No :</font></td>\n");
	    htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getFaxNumber() == null) ? "" : quotation.getFaxNumber()) + "</font></td><td width='3%'>&nbsp;</td>\n");
	    htmlView.append ("<td width='21%'>Email :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getEmail() == null) ? "" : quotation.getEmail()) + "</font></td><td width='3%'>&nbsp;</td></tr>\n");

        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'>Sales Person :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getSalesPerson() == null) ? "" : quotation.getSalesPerson()) + "</font></td><td width='3%'>&nbsp;</td>\n");
        htmlView.append ("<td width='21%'>"+representativeLabel+ " :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getSalesRep() == null) ? "" : quotation.getSalesRep()) + "</font></td><td width='3%'>&nbsp;</td></tr>\n");

        htmlView.append( "</tr><tr bgColor='#e6e6e6'><td width='21%'>Regional Rep :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getRegionalRep() == null ) ? "" : quotation.getRegionalRep() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );
        htmlView.append( "<td width='21%'>Quote Date :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getQuotationDate() == null ) ? "" : quotation.getQuotationDate() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );

        htmlView.append( "</tr><tr bgColor='#e6e6e6'><td width='21%'> " + endCustomerLabel + " :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getOdm() == null ) ? "" : quotation.getOdm() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );
        htmlView.append( "<td width='21%'> " + endUserLabel + " :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getEndCustomer() == null ) ? "" : quotation.getEndCustomer() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );

        htmlView.append( "</tr><tr bgColor='#e6e6e6'><td width='21%'>"+shippingMethodLabel+" :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( ( quotation.getShippingMethodName() == null ) || ( quotation.getShippingMethodName().trim().length() == 0 ) ) ? "" : quotation.getShippingMethodName() + "   #   " + quotation.getShippingAccount() ) + "</font></td><td width='3%'>&nbsp;</td><td></td><td></td><td></td>\n" );

        htmlView.append( "</tr><tr  bgColor='#e6e6e6'><td width='21%'>Pay Terms :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getShippingTerms() == null ) ? "" : quotation.getShippingTerms() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );
        htmlView.append( "<td width='21%'>"+deliveryTermsLabel+ " :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getDeliveryTerms() == null ) ? "" : quotation.getDeliveryTerms() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );

        htmlView.append ("</tr><tr bgColor='#e6e6e6'><td width='21%'>Billing Address :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getBillingAddress() == null) ? "" : quotation.getBillingAddressAsHTML()) + "</font></td><td width='3%'>&nbsp;</td>\n");
        htmlView.append ("<td width='21%'>Shipping Address :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getShippingAddress() == null) ? "" : quotation.getShippingAddressAsHTML()) + "</font></td><td width='3%'>&nbsp;</td>\n");

        htmlView.append( "</tr><tr bgColor='#e6e6e6'><td width='21%'>Freight Instructions :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getFreightInstructions() == null ) ? "" : quotation.getFreightInstructions() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );
        htmlView.append( "<td width='21%'>Shipping Instructions :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getShippingInstructions() == null ) ? "" : quotation.getShippingInstructions() ) + "</font></td><td width='3%'>&nbsp;</td></tr>\n" );

        htmlView.append( "</tr><tr bgColor='#e6e6e6'><td width='21%'>Quotation Expires On :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getExpiryDate() == null ) ? "" : quotation.getExpiryDate() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );
        htmlView.append( "<td width='21%'>Comments :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getComments() == null ) ? "" : quotation.getComments() ) + "</font></td><td width='3%'>&nbsp;</td></tr>\n" );

        htmlView.append ("</td></tr><tr><td colspan=6></td></tr><tr><td colspan=6><br></td></tr><tr><td colspan=6>\n");


        if (presentLineItems.isEmpty() == false) {

            htmlView.append ("<TABLE style='FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana' borderColor='#ffffff' cellSpacing='1' cellPadding='3' width='100%' border=0><tr bgColor='#ccccff'>\n");
            htmlView.append ("<td width='5%' align='center'>PO Line Item</td>\n");
            htmlView.append ("<td width='5%' align='center'>Line Item</td>\n");

            htmlView.append ("<td width='7%' align='center'>"+mfgPartNumberLabel+"</td>\n");
            htmlView.append ("<td width='7%' align='center'>"+customerPartNumberLabel+"</td>\n");
            if ( isClientAirgo ){
                htmlView.append ("<td width='7%' align='center'>"+labelNumberLabel+"</td>\n");
            }
            htmlView.append ("<td width='8%' align='center'>Description</td>\n");
            htmlView.append ("<td width='8%' align='center'>Taxable</td>\n");
            if ( isClientAirgo ){
                htmlView.append ("<td width='5%' align='center'>Proposed Date</td>\n");
                htmlView.append ("<td width='5%' align='center'>Proposed Quantity</td>\n");
            }
            htmlView.append ("<td width='10%' align='center'>Req'd Dock Date</td>\n");
            htmlView.append ("<td width='10%' align='center'>Lead Time</td>\n");
            htmlView.append ("<td width='5%' align='center'>Quantity</td>\n");
            if(ConfigManager.isShowQuoteMinOrderQty()) {
                htmlView.append ("<td width='10%' align='center'>Min Order Quantity</td>\n");
            }
            if ( quotation.isDistributor() )
            {
                if ( ConfigManager.isShowQuoteRequestedPrice() )
                {
                    htmlView.append ("<td width='10%' align='center'>" + requestedPriceLabel + "</td>\n");
                }
                if ( ConfigManager.isShowQuoteCustResalePrice() )
                {
                    htmlView.append ("<td width='10%' align='center'>" + custResalePriceLabel + "</td>\n");
                }
            }
            htmlView.append ("<td width='10%' align='center'>" + priceLabel + "</td>\n");
            if ( quotation.isDistributor() )
            {
                if ( ConfigManager.isShowQuoteSuggResalePrice() )
                {
                    htmlView.append ("<td width='10%' align='center'>" + suggResalePriceLabel + "</td>\n");
                }
            }
            htmlView.append ("<td width='10%' align='center'>Amount</td>\n");
            htmlView.append ("<td width='20%' align='center'>Hold</td></tr>\n");

            Iterator lineItems = presentLineItems.iterator();
            LineItem lineItem = null;
            String hold = "";
            while (lineItems.hasNext()) {

                lineItem = (LineItem) lineItems.next();

                if(lineItem.getIsApproved())
                {
                    hold = "&nbsp;";
                }
                else
                {
                    hold = "X";
                }
                htmlView.append ("<tr bgColor='#e6e6e6'><td width='5%' align='center'><font class='bodytext'>" + lineItem.getPoLineItemNo() + "</font></td>\n");
                htmlView.append ("<td width='5%' align='center'><font class='bodytext'>" + lineItem.getLineItemNo() + "</font></td>\n");
                htmlView.append ("<td width='7%' align='center' nowrap><font class='bodytext'>" + lineItem.getManufacturingPartNo() + "</font></td>\n");
                htmlView.append ("<td width='7%' align='center' nowrap><font class='bodytext'>" + ( lineItem.getCustomerPartNo() == null ? "" : lineItem.getCustomerPartNo()) + "</font></td>\n");
                if ( isClientAirgo ) {
                    htmlView.append ("<td width='7%' align='center' nowrap><font class='bodytext'>" + ( lineItem.getLabelNumber() == null  ? "" : lineItem.getLabelNumber() )+ "</font></td>\n");
                }

                String desc =  lineItem.getLineItemDescription();
                if(desc == null) desc = "";
                htmlView.append ("<td width='8%' align='center' nowrap><font class='bodytext'>" + desc + "</font></td>\n");
                htmlView.append ("<td width='5%' align='center' nowrap><font class='bodytext'>" + ( lineItem.getIsTaxable() ? "Yes" : "No" ) + "</font></td>\n");
                if ( isClientAirgo ) {
                    htmlView.append ("<td width='10%' align='center'><font class='bodytext'>" + ((lineItem.getQuotedDate() == null) ? "" : lineItem.getQuotedDate()) + "</font></td>\n");
                    htmlView.append ("<td width='5%' align='right'><font class='bodytext'>" + StringUtils.formatUnits(lineItem.getQuotedQuantity()) + "</font></td>\n");
                }
                htmlView.append ("<td width='10%' align='center'><font class='bodytext'>" + ((lineItem.getRequestDate() == null) ? "" : lineItem.getRequestDate()) + "</font></td>\n");
                htmlView.append ("<td width='10%' align='center'><font class='bodytext'>" + ((lineItem.getLeadTime() == null) ? "" : lineItem.getLeadTime()) + "</font></td>\n");
                htmlView.append ("<td width='5%' align='right'><font class='bodytext'>" + StringUtils.formatUnits(lineItem.getQuantity()) + "</font></td>\n");
                if(ConfigManager.isShowQuoteMinOrderQty()) {
                    htmlView.append ("<td width='5%' align='right'><font class='bodytext'>" + StringUtils.formatUnits(lineItem.getMinOrderQty()) + "</font></td>\n");
                }
                if ( quotation.isDistributor() )
                {
                    if ( ConfigManager.isShowQuoteRequestedPrice() )
                    {
                        htmlView.append ("<td  align='right' nowrap><font class='bodytext'>" + lineItem.getReqPriceAsString() + "</font></td>\n");
                    }
                    if ( ConfigManager.isShowQuoteCustResalePrice() )
                    {
                        htmlView.append ("<td  align='right' nowrap><font class='bodytext'>"+ lineItem.getCustResaleAsString() + "</font></td>\n");
                    }
                }
                htmlView.append ("<td  align='right' nowrap><font class='bodytext'>$"+StringUtils.formatAmountWithNoOfDecimals(lineItem.getUnitPriceAsDouble())+"</font></td>\n");
                if ( quotation.isDistributor() )
                {
                    if ( ConfigManager.isShowQuoteSuggResalePrice() )
                    {
                        htmlView.append ("<td  align='right' nowrap><font class='bodytext'>" + lineItem.getSuggResaleAsString() + "</font></td>\n");
                    }
                }

                htmlView.append ("<td  align='right' nowrap><font class='bodytext'>$"+StringUtils.formatAmountWithNoOfDecimals(lineItem.getAmountAsDouble())+"</font></td>\n");
                htmlView.append ("<td width='20%' align='center'><font class='bodytext'>&nbsp;[" + hold.trim() + "]&nbsp;</font></td></tr>\n");

                if(lineItem.getIsApproved())
                {
                    status_temp = "";
                }
                else
                {
                    status_temp = "HOLD";
                }

                if( ("HOLD".equalsIgnoreCase(status_temp)) || ("PENDING".equalsIgnoreCase(status_temp))){
                    sales_order_status = true;
                }
            }
            htmlView.append ("</table>");
        }

        htmlView.append ("</td></tr><tr><td colspan='6' align='center'><br></td></tr>");
        htmlView.append ("<tr><td colspan='6' align='center'><a href='http://").append (ConfigManager.getChipTracHost()).append ("/").append (ConfigManager.getChipTracContext());

        if(sales_order_status)
        htmlView.append (QUOTE_URI_1).append (quotationId).append ("&quotation=0&isSample=1'><strong>Please click here to go to the Quote page</strong></a></td></tr>");
        htmlView.append ("</table></td></tr></table>\n");

        htmlView.append ("<br><br><br><br><table width='70%' border='0' style='FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana'>");
        htmlView.append ("<tr><td>___________________________________________________________</td></tr>");
        htmlView.append ("<tr><td>You are receiving this email because you have the access rights to</td></tr>");
        htmlView.append ("<tr><td>approve a quote from ChipTrac System. If you no longer wish you receive this email</td></tr>");
        htmlView.append ("<tr><td>Please contact your system administrator.</td></tr></table>");
        htmlView.append ("<br><br></BODY></HTML>\n");

        return htmlView.toString();
    }

    public static String getHtmlViewWithChangeSummary( int salesOrderId, String changeSummary ) throws ScalarException
    {
        Quotation quotation = QuotationDAO.loadQuotation( salesOrderId + "", false );
        return quotation.getHtmlViewWithChangeSummary(changeSummary );
    }

    public String getHtmlViewWithChangeSummary( String changeSummary ) throws ScalarException
    {

        Quotation quotation = this;
        ArrayList presentLineItems = QuotationDAO.loadOrderLineItemsWithCustomerPartNo ( quotation.getQuotationId (), quotation.getCustomerId () );

        if (presentLineItems == null) presentLineItems = new ArrayList();

        boolean isClientAirgo = false;
        String endUserLabel = null;
        String endCustomerLabel = null;
        String poRevLabel = null;
        String poDateLabel = null;
        String poNoLabel = null;
        String representativeLabel = null;
        String mfgPartNumberLabel = null;
        String customerPartNumberLabel = null;
        String labelNumberLabel = null;
        try
        {
            endCustomerLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.endCustomer" );
            if ( endCustomerLabel == null )
            {
                endCustomerLabel = Labels.DEFAULT_END_CUSTOMER_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            endCustomerLabel    = Labels.DEFAULT_END_CUSTOMER_LABEL;
        }
        try
        {
            endUserLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.endUser" );
            if ( endUserLabel == null )
            {
                endUserLabel = Labels.DEFAULT_END_USER_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            endUserLabel    = Labels.DEFAULT_END_CUSTOMER_LABEL;
        }
        try
        {
            poRevLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.PoRevisionNumber" );
            if ( poRevLabel == null )
            {
                poRevLabel = Labels.DEFAULT_PO_REV;
            }
        }
        catch ( NullPointerException e )
        {
            poRevLabel = Labels.DEFAULT_PO_REV;
        }
        try
        {
            poDateLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.PoDate" );
            if ( poDateLabel == null )
            {
                poDateLabel = Labels.DEFAULT_PO_DATE;
            }
        }
        catch ( NullPointerException e )
        {
            poDateLabel = Labels.DEFAULT_PO_DATE;
        }
        try
        {
            poNoLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.PoNumber" );
            if ( poNoLabel == null )
            {
                poNoLabel = Labels.DEFAULT_PO_NO;
            }
        }
        catch ( NullPointerException e )
        {
            poNoLabel = Labels.DEFAULT_PO_NO;
        }

        try
        {
            representativeLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesRep.Name" );
            if ( representativeLabel == null )
            {
                representativeLabel = Labels.DEFAULT_REPRESENTATIVE;
            }
        }
        catch ( NullPointerException e )
        {
            representativeLabel = Labels.DEFAULT_REPRESENTATIVE;
        }
        String shippingMethodLabel = null;
        String shippingAccountLabel = null;
        try
        {
            shippingMethodLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.ShippingMethod" );
            if ( shippingMethodLabel == null )
            {
                shippingMethodLabel = Labels.DEFAULT_SHIPPING_METHOD_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            shippingMethodLabel    = Labels.DEFAULT_SHIPPING_METHOD_LABEL;
        }
        try
        {
            shippingAccountLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.ShippingAccount" );
            if ( shippingAccountLabel == null )
            {
                shippingAccountLabel = Labels.DEFAULT_SHIPPING_ACCOUNT_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            shippingAccountLabel = Labels.DEFAULT_SHIPPING_ACCOUNT_LABEL;
        }
        String deliveryTermsLabel = null;
        try
        {
            deliveryTermsLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.salesOrder.DeliveryTerms" );
            if ( deliveryTermsLabel == null )
            {
                deliveryTermsLabel = Labels.DEFAULT_DELIVERY_TERMS_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            deliveryTermsLabel    = Labels.DEFAULT_DELIVERY_TERMS_LABEL;
        }
        try
        {
            mfgPartNumberLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.mfgPartNumber" );
            if ( mfgPartNumberLabel == null )
            {
                mfgPartNumberLabel = Labels.DEFAULT_MFG_PART_NUMBER_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            mfgPartNumberLabel  = Labels.DEFAULT_MFG_PART_NUMBER_LABEL;
        }
        try
        {
            customerPartNumberLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.customerPartNumber" );
            if ( customerPartNumberLabel == null )
            {
                customerPartNumberLabel = Labels.DEFAULT_CUSTOMER_PART_NUMBER_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            customerPartNumberLabel  = Labels.DEFAULT_CUSTOMER_PART_NUMBER_LABEL;
        }
        try
        {
            labelNumberLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.labelNumber" );
            if ( labelNumberLabel == null )
            {
                labelNumberLabel = Labels.DEFAULT_LABEL_NUMBER_LABEL;
            }
        }
        catch ( NullPointerException e )
        {
            labelNumberLabel  = Labels.DEFAULT_LABEL_NUMBER_LABEL;
        }
        if ( Constants.CLIENT_NAME_AIRGO.equalsIgnoreCase(ConfigManager.getClientNameAirgo() ) ) {
            isClientAirgo = true;
        }
        String requestedPriceLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.requestedPrice" );
        if ( requestedPriceLabel == null )
        {
            requestedPriceLabel = Labels.DEFAULT_REQUESTED_PRICE_LABEL;
        }
        String custResalePriceLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.customerResalePrice" );
        if ( custResalePriceLabel == null )
        {
            custResalePriceLabel = Labels.DEFAULT_CUST_RESALE_PRICE_LABEL;
        }
        String priceLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.price" );
        if ( priceLabel == null )
        {
            priceLabel = Labels.DEFAULT_PRICE_LABEL;
        }
        String suggResalePriceLabel = MessageResources.getMessageResources ( Labels.APPLICATION_RESOURCE_PROPERTIES ).getMessage ( "label.sales.suggestedResalePrice" );
        if ( suggResalePriceLabel == null )
        {
            suggResalePriceLabel = Labels.DEFAULT_SUGG_RESALE_PRICE_LABEL;
        }
        // NOW WE HAVE ALL THE VALUES REQUIRED -- BUILD THE HTML PAGE
        StringBuffer htmlView = new StringBuffer();

        htmlView.append ("<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE><META http-equiv=Content-Type content='text/html; charset=windows-1252'>\n");

        htmlView.append ("<style type=\"text/css\">");
        htmlView.append ("#toc a{ font-family: Verdana;font-style : normal ;font-size : 7pt; font-weight :bold;}");
        htmlView.append ("#toc p{font-family: Verdana;font-style : normal ;font-size : 7pt; font-weight :bold;text-align :center;color :#FFFFFF}");
        htmlView.append ("#toc {border-style : solid;border-color :#000000 ;border-width :medium }");
        htmlView.append ("</style></head>\n");


        htmlView.append ("<BODY bgColor='#ffffff' leftMargin=0 topMargin=0 marginheight='0' marginwidth='0'><br>\n");

        htmlView.append ("<TABLE cellSpacing=0 cellPadding=0 width='100%' border=1 bgcolor='#FFFFFF' align='center' style='FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana'><tr><td>\n");
        htmlView.append ("<table cellSpacing=0 cellPadding=3 width='100%' border=0 bgcolor='#FFFFFF' align='center' style='FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana'>\n");
        htmlView.append ("<tr><td colspan='6' align='center'><br></td></tr>\n");
        if(!changeSummary.equals(""))
        htmlView.append ("<tr><td colspan='6' align='left' bgcolor='#e6e6e6'><b>Change Summary:</b>" +  changeSummary  + "<br></td></tr>\n");
        htmlView.append ("<tr><td colspan='6' bgcolor='#ccccff' valign='center' align='center'><SPAN style='FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana'><strong>Quote</strong></span></td></tr>\n");

        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'>Created By:</font></td>\n");
 	    htmlView.append ("<td width='21%' class='bodytext'>" + ((quotation.getEnteredById() == null) ? "" : quotation.getEnteredById()) + "</td>\n");
 	    htmlView.append ("<td width='3%'>&nbsp;</td><td width='21%'>Last Updated On:</font></td>\n");
 	    htmlView.append ("<td width='21%' class='bodytext'>" + ((quotation.getEnteredDate() == null) ? "" : quotation.getEnteredDate()) + "</td>\n");

        htmlView.append ("<td width='3%'>&nbsp;</td></tr><tr bgColor='#e6e6e6'><td colspan='6' align='center'><br></td></tr>\n");
        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'><font class='NArialL'>Quote No:</font></td>\n");
	    htmlView.append ("<td width='21%' class='bodytext'><b>" + quotation.getQuotationNo() + "</b></td>\n");
        htmlView.append ("<td width='3%'>&nbsp;</td><td width='21%'>Customer Name :</font></td>");
	    htmlView.append ("<td width='21%' class='bodytext'>" + quotation.getCustomerName() + "</td><td width='3%'>&nbsp;</td></tr>\n");

        htmlView.append( "<tr bgColor='#e6e6e6'><td width='21%'>Quote Revision :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + QuotationDAO.loadRevisionNumber( null, quotation.getQuotationId() ) + "</font></td><td width='3%'>&nbsp;</td><td></td><td></td><td></td>\n" );

        htmlView.append ("</tr><tr bgColor='#e6e6e6'><td width='21%'>"+poRevLabel+ " :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getPoRev() == null) ? "" : quotation.getPoRev()) + "</font></td><td width='3%'>&nbsp;</td>\n");
        htmlView.append ("<td width='21%'>"+poDateLabel+ ":</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getPoDate() == null) ? "" : quotation.getPoDate()) + "</font></td><td width='3%'>&nbsp;</td></tr>\n");

        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'>"+poNoLabel+":</font></td>\n");
	    htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getCustomerPO() == null) ? "" : quotation.getCustomerPO()) + "</font></td><td width='3%'>&nbsp;</td>\n");
	    htmlView.append ("<td width='21%'>Contact Person :</font></td>\n");
	    htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getContactPerson() == null) ? "" : quotation.getContactPerson()) + "</font></td><td width='3%'>&nbsp;</td></tr>\n");

        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'>Phone No :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getPhoneNumber() == null) ? "" : quotation.getPhoneNumber()) + "</font></td><td width='3%'>&nbsp;</td>\n");
        htmlView.append ("<td width='21%'>Cell No :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getCellNumber() == null) ? "" : quotation.getCellNumber()) + "</font></td><td width='3%'>&nbsp;</td></tr>\n");

        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'>Fax No :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getFaxNumber() == null) ? "" : quotation.getFaxNumber()) + "</font></td><td width='3%'>&nbsp;</td>\n");
        htmlView.append ("<td width='21%'>Email :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getEmail() == null) ? "" : quotation.getEmail()) + "</font></td><td width='3%'>&nbsp;</td></tr>\n");

        htmlView.append ("<tr bgColor='#e6e6e6'><td width='21%'>Sales Person :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getSalesPerson() == null) ? "" : quotation.getSalesPerson()) + "</font></td><td width='3%'>&nbsp;</td>\n");
        htmlView.append ("<td width='21%'>"+representativeLabel+ "</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getSalesRep() == null) ? "" : quotation.getSalesRep()) + "</font></td><td width='3%'>&nbsp;</td></tr>\n");

        htmlView.append( "</tr><tr bgColor='#e6e6e6'><td width='21%'>Regional Rep :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getRegionalRep() == null ) ? "" : quotation.getRegionalRep() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );
        htmlView.append( "<td width='21%'>Quote Date :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getQuotationDate() == null ) ? "" : quotation.getQuotationDate() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );

        htmlView.append( "</tr><tr bgColor='#e6e6e6'><td width='21%'> " + endCustomerLabel + " :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getOdm() == null ) ? "" : quotation.getOdm() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );
        htmlView.append( "<td width='21%'> " + endUserLabel + " :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getEndCustomer() == null ) ? "" : quotation.getEndCustomer() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );

        htmlView.append( "</tr><tr bgColor='#e6e6e6'><td width='21%'>"+shippingMethodLabel+" :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( ( quotation.getShippingMethodName() == null ) || ( quotation.getShippingMethodName().trim().length() == 0 ) ) ? "" : quotation.getShippingMethodName() + "   #   " + quotation.getShippingAccount() ) + "</font></td><td width='3%'>&nbsp;</td><td></td><td></td><td></td>\n" );

        htmlView.append( "</tr><tr  bgColor='#e6e6e6'><td width='21%'>Pay Terms :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getShippingTerms() == null ) ? "" : quotation.getShippingTerms() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );
        htmlView.append( "<td width='21%'>"+deliveryTermsLabel+ ":</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getDeliveryTerms() == null ) ? "" : quotation.getDeliveryTerms() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );


        htmlView.append ("</tr><tr bgColor='#e6e6e6'><td width='21%'>Billing Address :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getBillingAddress() == null) ? "" : quotation.getBillingAddressAsHTML()) + "</font></td><td width='3%'>&nbsp;</td>\n");
        htmlView.append ("<td width='21%'>Shipping Address :</font></td>\n");
        htmlView.append ("<td width='21%'><font class='bodytext'>" + ((quotation.getShippingAddress() == null) ? "" : quotation.getShippingAddressAsHTML()) + "</font></td><td width='3%'>&nbsp;</td>\n");

        htmlView.append( "</tr><tr bgColor='#e6e6e6'><td width='21%'>Freight Instructions :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getFreightInstructions() == null ) ? "" : quotation.getFreightInstructions() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );
        htmlView.append( "<td width='21%'>Shipping Instructions :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getShippingInstructions() == null ) ? "" : quotation.getShippingInstructions() ) + "</font></td><td width='3%'>&nbsp;</td></tr>\n" );

        htmlView.append( "</tr><tr bgColor='#e6e6e6'><td width='21%'>Quotation Expires On :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getExpiryDate() == null ) ? "" : quotation.getExpiryDate() ) + "</font></td><td width='3%'>&nbsp;</td>\n" );
        htmlView.append( "<td width='21%'>Comments :</font></td>\n" );
        htmlView.append( "<td width='21%'><font class='bodytext'>" + ( ( quotation.getComments() == null ) ? "" : quotation.getComments() ) + "</font></td><td width='3%'>&nbsp;</td></tr>\n" );

        htmlView.append ("</td></tr><tr><td colspan=6></td></tr><tr><td colspan=6><br></td></tr><tr><td colspan=6>\n");


        if (presentLineItems.isEmpty() == false) {

            htmlView.append ("<TABLE style='FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana' borderColor='#ffffff' cellSpacing='1' cellPadding='3' width='100%' border=0><tr bgColor='#ccccff'>\n");
            htmlView.append ("<td width='5%' align='center' >PO Line Item</td>\n");

            htmlView.append ("<td width='5%' align='center' >Line Item</td>\n");
            htmlView.append ("<td width='7%' align='center'>"+mfgPartNumberLabel+"</td>\n");
            htmlView.append ("<td width='7%' align='center'>"+customerPartNumberLabel+"</td>\n");
            if ( isClientAirgo ){
                htmlView.append ("<td width='7%' align='center'>"+labelNumberLabel+"</td>\n");
            }
            htmlView.append ("<td width='8%' align='center' >Description</td>\n");
            htmlView.append ("<td width='8%' align='center' >Taxable</td>\n");
            if ( isClientAirgo ){
                htmlView.append ("<td width='5%' align='center'>Proposed Date</td>\n");
                htmlView.append ("<td width='5%' align='center'>Proposed Quantity</td>\n");
            }
            htmlView.append ("<td width='10%' align='center' >Req'd Dock Date</td>\n");
            htmlView.append ("<td width='10%' align='center' >Lead Time</td>\n");
            htmlView.append ("<td width='5%' align='center' >Quantity</td>\n");
            if(ConfigManager.isShowQuoteMinOrderQty()) {
                htmlView.append ("<td width='10%' align='center'>Min Order Quantity</td>\n");
            }
            if ( quotation.isDistributor() )
            {
                if ( ConfigManager.isShowQuoteRequestedPrice() )
                {
                    htmlView.append ("<td width='10%' align='center'>" + requestedPriceLabel + "</td>\n");
                }
                if ( ConfigManager.isShowQuoteCustResalePrice() )
                {
                    htmlView.append ("<td width='10%' align='center'>" + custResalePriceLabel + "</td>\n");
                }
            }
            htmlView.append ("<td width='10%' align='center' >" + priceLabel + "</td>\n");
            if ( quotation.isDistributor() )
            {
                if ( ConfigManager.isShowQuoteSuggResalePrice() )
                {
                    htmlView.append ("<td width='10%' align='center'>" + suggResalePriceLabel + "</td>\n");
                }
            }
            htmlView.append ("<td width='10%' align='center' >Amount</td>\n");
            htmlView.append ("<td width='20%' align='center' >Hold</td></tr>\n");

            Iterator lineItems = presentLineItems.iterator();
            LineItem lineItem = null;
            String hold = "";

            while (lineItems.hasNext()) {

                lineItem = (LineItem) lineItems.next();

                if(lineItem.getIsApproved())
                {
                    hold = "&nbsp;";
                }
                else
                {
                    hold = "X";
                }

                htmlView.append ("<tr bgColor='#e6e6e6'><td width='5%' align='center'><font class='bodytext'>" + lineItem.getPoLineItemNo() + "</font></td>\n");
                htmlView.append ("<td width='5%' align='center' nowrap><font class='bodytext'>" + lineItem.getLineItemNo() + "</font></td>\n");
                htmlView.append ("<td width='7%' align='center' nowrap><font class='bodytext'>" + lineItem.getManufacturingPartNo() + "</font></td>\n");
                htmlView.append ("<td width='7%' align='center' nowrap><font class='bodytext'>" + ( lineItem.getCustomerPartNo() == null ? "" : lineItem.getCustomerPartNo() )+ "</font></td>\n");
                if ( isClientAirgo ) {
                    htmlView.append ("<td width='7%' align='center' nowrap><font class='bodytext'>" + ( lineItem.getLabelNumber() == null ? "" : lineItem.getLabelNumber() )+ "</font></td>\n");
                }
                String desc =  lineItem.getLineItemDescription();
                if(desc == null) desc = "";
                htmlView.append ("<td width='8%' align='center' nowrap><font class='bodytext'>" + desc + "</font></td>\n");
                htmlView.append ("<td width='5%' align='center' nowrap><font class='bodytext'>" + ( lineItem.getIsTaxable() ? "Yes" : "No" ) + "</font></td>\n");
                if ( isClientAirgo ) {
                    htmlView.append ("<td width='10%' align='center'><font class='bodytext'>" + ((lineItem.getQuotedDate() == null) ? "" : lineItem.getQuotedDate()) + "</font></td>\n");
                    htmlView.append ("<td width='5%' align='right'><font class='bodytext'>" + StringUtils.formatUnits(lineItem.getQuotedQuantity()) + "</font></td>\n");
                }
                htmlView.append ("<td width='10%' align='center' ><font class='bodytext'>" + ((lineItem.getRequestDate() == null) ? "" : lineItem.getRequestDate()) + "</font></td>\n");
                htmlView.append ("<td width='10%' align='center' ><font class='bodytext'>" + ((lineItem.getLeadTime() == null) ? "" : lineItem.getLeadTime()) + "</font></td>\n");
                htmlView.append ("<td width='5%' align='right' ><font class='bodytext'>" + StringUtils.formatUnits(lineItem.getQuantity()) + "</font></td>\n");
                if(ConfigManager.isShowQuoteMinOrderQty()) {
                    htmlView.append ("<td width='5%' align='right' ><font class='bodytext'>" + StringUtils.formatUnits(lineItem.getMinOrderQty()) + "</font></td>\n");
                }
                if ( quotation.isDistributor() )
                {
                    if ( ConfigManager.isShowQuoteRequestedPrice() )
                    {
                        htmlView.append ("<td  align='right' nowrap><font class='bodytext'>" + lineItem.getReqPriceAsString() + "</font></td>\n");
                    }
                    if ( ConfigManager.isShowQuoteCustResalePrice() )
                    {
                        htmlView.append ("<td  align='right' nowrap><font class='bodytext'>"+ lineItem.getCustResaleAsString() + "</font></td>\n");
                    }
                }
                htmlView.append ("<td  align='right' nowrap><font class='bodytext'>$"+StringUtils.formatAmountWithNoOfDecimals(lineItem.getUnitPriceAsDouble())+"</font></td>\n");
                if ( quotation.isDistributor() )
                {
                    if ( ConfigManager.isShowQuoteSuggResalePrice() )
                    {
                        htmlView.append ("<td  align='right' nowrap><font class='bodytext'>" + lineItem.getSuggResaleAsString() + "</font></td>\n");
                    }
                }
                htmlView.append ("<td  align='right' nowrap><font class='bodytext'>$"+StringUtils.formatAmountWithNoOfDecimals(lineItem.getAmountAsDouble())+"</font></td>\n");
                htmlView.append ("<td width='20%' align='center' ><font class='bodytext'>&nbsp;[" + hold.trim() + "]&nbsp;</font></td></tr>\n");

                if(lineItem.getIsApproved())
                {
                    status_temp = "";
                }
                else
                {
                    status_temp = "HOLD";
                }

                if( ("HOLD".equalsIgnoreCase(status_temp)) || ("PENDING".equalsIgnoreCase(status_temp))){
                    sales_order_status = true;
                }
            }
            htmlView.append ("</table>");
        }

        htmlView.append ("</td></tr><tr><td colspan='6' align='center'><br></td></tr>");
        htmlView.append ("<tr><td colspan='6' align='center'><a href='http://").append (ConfigManager.getChipTracHost()).append ("/").append (ConfigManager.getChipTracContext());

        if(sales_order_status)
        htmlView.append (QUOTE_URI_1).append (quotationId).append ("&quotation=0&isSample=1'><strong>Please click here to go to the Quote page</strong></a></td></tr>");
        else
        htmlView.append ("'></a></td></tr>");

        htmlView.append ("</table></td></tr></table>\n");

        htmlView.append ("<br><br><br><br><table width='70%' border='0' style='FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana'>");
        htmlView.append ("<tr><td>___________________________________________________________</td></tr>");
        htmlView.append ("<tr><td>You are receiving this email because you have the access rights to</td></tr>");
        htmlView.append ("<tr><td>approve a sales order from ChipTrac System. If you no longer wish you receive this email</td></tr>");
        htmlView.append ("<tr><td>Please contact your system administrator.</td></tr></table>");

        htmlView.append ("<br><br></BODY></HTML>\n");

        return htmlView.toString();
    }

    public String getTotalQuantity()
    {
        return totalQty;
    }
    public void setTotalQty(String totalQty)
    {
        this.totalQty = totalQty;
    }
    public String getTotalAmount()
    {
        return totalAmount;
    }
    public void setTotalAmount(String totalAmount)
    {
        this.totalAmount = totalAmount;
    }

    public String getSalesTaxType()
    {
        return salesTaxType;
    }
    public void setSalesTaxType(String salesTaxType)
    {
        this.salesTaxType = salesTaxType;
    }

    public float getSubTotal()
    {
        return subTotal;
    }
    public String getSubTotalAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals( subTotalAsDouble );
    }
    public void setSubTotal(float subTotal)
    {
        this.subTotal = subTotal;
    }


    public float getSalesTax()
    {
        return salesTax;
    }
    public String getSalesTaxAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals( salesTaxAsDouble );
    }
    public void setSalesTax(float salesTax)
    {
        this.salesTax = salesTax;
    }

    public String getFrieghtAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals( frieghtAsDouble);
    }
    public float getFrieght()
    {
        return frieght;
    }
    public void setFrieght(float frieght)
    {
        this.frieght = frieght;
    }

    public String getMiscAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals( miscAsDouble);
    }
    public float getMisc()
    {
        return misc;
    }
    public void setMisc(float misc)
    {
        this.misc = misc;
    }

    public float getOrderTotal()
    {
        return orderTotal;
    }
    public String getOrderTotalAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals( orderTotalAsDouble);
    }
    public void setOrderTotal(float orderTotal)
    {
        this.orderTotal = orderTotal;
    }

    public double getSubTotalAsDouble()
    {
	   return subTotalAsDouble;
    }

   public void setSubTotalAsDouble(double subTotalAsDouble)
   {
	   this.subTotalAsDouble = subTotalAsDouble;
   }

   public double getSalesTaxAsDouble()
   {
	  return salesTaxAsDouble;
   }

   public void setSalesTaxAsDouble(double salesTaxAsDouble)
   {
	  this.salesTaxAsDouble = salesTaxAsDouble;
   }

   public double getFrieghtAsDouble()
   {
	 return frieghtAsDouble;
   }
   public void setFrieghtAsDouble(double frieghtAsDouble)
   {
	 this.frieghtAsDouble = frieghtAsDouble;
   }

   public double getMiscAsDouble()
   {
	   return miscAsDouble;
   }
   public void setMiscAsDouble(double miscAsDouble)
   {
	   this.miscAsDouble = miscAsDouble;
   }

   public double getOrderTotalAsDouble()
   {
	   return orderTotalAsDouble;
   }
   public void setOrderTotalAsDouble(double orderTotalAsDouble)
   {
	   this.orderTotalAsDouble = orderTotalAsDouble;
   }

    public String getMiscName()
    {
        return miscName;
    }
    public void setMiscName(String miscName)
    {
        if((miscName != null) && (miscName.length() > 0))
            this.miscName = miscName;
    }

    public void setFinalSubTotal(double finalSubTotal)
    {
        this.finalSubTotal = finalSubTotal;
    }

    public double getFinalSubTotal()
    {
        return   finalSubTotal;
    }
    public String getFinalSubTotalAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals( finalSubTotal);
    }

    public void setFinalSalesTax(double finalSalesTax)
    {
         this.finalSalesTax = finalSalesTax;
    }

    public double getFinalSalesTax()
    {
         return   finalSalesTax;
    }
    public String getFinalSalesTaxAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals( finalSalesTax );
    }

    public void setFinalOrderTotal(double finalOrderTotal)
    {
         this.finalOrderTotal = finalOrderTotal;
    }

    public double getFinalOrderTotal()
    {
        return   finalOrderTotal;
    }

    public String getFinalOrderTotalAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals( finalOrderTotal);
    }



    public String getNewShippingMethod()
    {
        return newShippingMethod;
    }
    public void setNewShippingMethod(String newShippingMethod)
    {
        this.newShippingMethod = newShippingMethod;
    }

    public Address getBillingAddressAsObject()
    {
        return billingAddressAsObject;
    }
    public void setBillingAddressAsObject(Address address)
    {
        billingAddressAsObject = address;
    }
    public Address getShippingAddressAsObject()
    {
        return shippingAddressAsObject;
    }
    public void setShippingAddressAsObject(Address address)
    {
        shippingAddressAsObject = address;
    }

    public static void main (String[] args) throws Exception
    {
        Quotation quotation = new Quotation();
        String message = quotation.getHtmlView (39);

        String from = "balaram@scalarsoft.com";
        String to = "balaram@scalarsoft.com";
        String subject = "sales order";
        Mailer.send (from, to, subject, message);
    }

    public String getRegionalRep()
    {
        return regionalRep;
    }
    public void setRegionalRep(String regionalRep)
    {
        this.regionalRep = regionalRep;
    }

    public String getShippingTerms()
    {
        return shippingTerms;
    }
    public void setShippingTerms(String shippingTerms)
    {
        this.shippingTerms = shippingTerms;
    }

    public String getDeliveryTerms()
    {
        return deliveryTerms;
    }
    public void setDeliveryTerms(String deliveryTerms)
    {
        this.deliveryTerms = deliveryTerms;
    }

    public void setSalesTaxValue(float salesTaxValue){
        this.salesTaxValue = salesTaxValue;
    }

    public float getSalesTaxValue(){
        return this.salesTaxValue;
    }

    public Address getClientAddressAsObject()
    {
        return clientAddressAsObject;
    }
    public void setClientAddressAsObject(Address address)
    {
        clientAddressAsObject = address;
    }
    public String getClientName()
    {
        return clientName;
    }
    public void setClientName(String clientName)
    {
        this.clientName = clientName;
    }

    public int getRevision() {
        return revision;
    }

    public void setRevision(int revision) {
        this.revision = revision;
    }

    public String getPoRev() {
        return poRev;
    }

    public void setPoRev(String poRev) {
        this.poRev = poRev;
    }

    public String getPoDate() {
        return poDate;
    }

    public void setPoDate(String poDate) {
        this.poDate = poDate;
    }

    public String getOdm() {
        return odm;
    }

    public void setOdm(String odm) {
        this.odm = odm;
    }

    public int getOdmId() {
        return odmId;
    }

    public void setOdmId(int odmId) {
        this.odmId = odmId;
    }

    public String getEndUserId() {
        return endUserId;
    }

    public void setEndUserId(String endUserId) {
        this.endUserId = endUserId;
    }

    public boolean getIsEndCustomerShipAddress() {
        return isEndCustomerShipAddress;
    }

    public void setIsEndCustomerShipAddress(boolean endCustomerShipAddress) {
        isEndCustomerShipAddress = endCustomerShipAddress;
    }

    public int getShippingInstructionsId() {
        return shippingInstructionsId;
    }

    public void setShippingInstructionsId(int shippingInstructionsId) {
        this.shippingInstructionsId = shippingInstructionsId;
    }

    public ArrayList getAllDeliveryTerms() {
        return allDeliveryTerms;
    }

    public void setAllDeliveryTerms(ArrayList allDeliveryTerms) {
        this.allDeliveryTerms = allDeliveryTerms;
    }

    public static String getClientAddressAsString(Address address)
       {
           StringBuffer tempAddress =  new StringBuffer("");
           String address1 = address.getAddress1();
           String address2 = address.getAddress2();
		   String address3 = address.getAddress3();
		   String address4 = address.getAddress4();
           String city     = address.getCity();
           String zipCode  = address.getZipCode();
           String state    = address.getState();
           String country  = address.getCountry();
           String phno     = address.getPhoneNumber();
           String faxno    = address.getFaxNumber();
           String countryName  = address.getCountry();

           if(address1!=null && !(address1.trim().equals("")))
           {
               tempAddress.append(address1);
           }
           if(address2!=null && !(address2.equals("")))
           {
				if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
				{
					 tempAddress.append("\n");
				}
               tempAddress.append(address2);
           }
		   if(address3!=null && !(address3.equals("")))
			 {
				  if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
				  {
					   tempAddress.append("\n");
				  }
				 tempAddress.append(address3);
			 }
			if(address4!=null && !(address4.equals("")))
			  {
				   if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
				   {
						tempAddress.append("\n");
				   }
				  tempAddress.append(address4);
			  }


           if(city!=null && !(city.equals("")))
           {
				if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
				{
					 tempAddress.append("\n");
				}
               tempAddress.append(city);
           }
           if(state!=null && !(state.equals("")))
           {
				if( city == null || city.trim().length() == 0 )
				{
					 tempAddress.append("\n");
				}
                else if(city!=null && !(city.equals("")))
                {
                   tempAddress.append(", ");
                }
               tempAddress.append(state);
           }


           if(zipCode!=null && !(zipCode.equals("")))
           {
               if( (state!=null && !(state.equals(""))) || (city!=null && !(city.equals(""))) )
			   {
                   tempAddress.append(" - ");
               }
               tempAddress.append(zipCode);
           }


           if(country!=null && !(country.equals("")))
           {
               if((zipCode!=null && !(zipCode.equals("")))||(state!=null && !(state.equals(""))))
               {
                   tempAddress.append(", ");
               }
               tempAddress.append(country);
           }

           if(phno !=null && !(phno.equals("")))
           {
               if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
               {
                   tempAddress.append("\n");
               }
               tempAddress.append("Tel:").append(phno);
           }
           if(faxno != null && !(faxno.equals("")) )
           {
               if( phno == null || phno.trim().length() == 0 )
               {
                    tempAddress.append("\n");
               }
			   else if(phno!=null && !(phno.equals("")))
			   {
				   tempAddress.append(", ");
			   }
                tempAddress.append("Fax:").append(faxno);
           }


           return tempAddress.toString();
       }



    public String getClientAddress()
    {
        return clientAddress;
    }

    public void setClientAddress(String clientAddress)
    {
        this.clientAddress = clientAddress;
    }


    public String getClientAddressAsHTML()
    {
        StringBuffer tempClientAddress=new StringBuffer("");
        for(int i=0;i<clientAddress.length();i++)
        {
            char ch = clientAddress.charAt(i);
            if(ch=='\n')
            {
                tempClientAddress.append("<br>");
            }
            else
            {
                tempClientAddress.append(ch);
            }
        }
        clientAddressAsHTML = tempClientAddress.toString();
        return clientAddressAsHTML;
    }


    public static String getClientAddressToLoad(Address address)
    {
        StringBuffer tempAddress =  new StringBuffer("");
        String address1 = address.getAddress1();
        String address2 = address.getAddress2();
        String address3 = address.getAddress3();
        String address4 = address.getAddress4();
        String city     = address.getCity();
        String zipCode  = address.getZipCode();
        String state    = address.getState();
        String country  = address.getCountry();
        String phno     = address.getPhoneNumber();
        String faxno    = address.getFaxNumber();
        String countryName  = address.getCountry();


        if( address1 != null && !( address1.trim().equals( "" ) ) )
        {
            tempAddress.append(address1);
        }
        if( address2 != null && !( address2.equals( "" ) ) )
        {
            if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
            {
                tempAddress.append(", ");
            }
            tempAddress.append(address2);
        }
	    if( address3 != null && !( address3.equals( "" ) ) )
        {
            if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
            {
                tempAddress.append(", ");
            }
            tempAddress.append(address3);
        }
	    if( address4 != null && !( address4.equals( "" ) ) )
	    {
            if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
			{
				 tempAddress.append(", ");
			}
		    tempAddress.append(address4);
	    }

	    if( city != null && !( city.equals( "" ) ) )
	    {
            if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
			{
				 tempAddress.append(", ");
			}
		    tempAddress.append(city);
	    }
	    if( state != null && !( state.equals( "" ) ) )
	    {
            if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
		    {
			    tempAddress.append(", ");
		    }
		    tempAddress.append(state);
	    }
	    if( zipCode != null && !( zipCode.equals( "" ) ) )
	    {
		    if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
		    {
                tempAddress.append(" - ");
		    }
		    tempAddress.append(zipCode);
	    }

        if( country != null && !( country.equals( "" ) ) )
        {
            if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
            {
                tempAddress.append(", ");
            }
            tempAddress.append(country);
        }

	  if(phno != null && !(phno.equals("")))
	  {
		  if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
		  {
			  tempAddress.append(", ");
		  }
		  tempAddress.append("Tel:").append(phno);
	  }

        if(faxno != null && !(faxno.equals("")) )
        {
            if( tempAddress.toString() != null && !(tempAddress.toString().equals("")) )
            {
                tempAddress.append(", ");
            }
            tempAddress.append("Fax:").append(faxno);
        }
        return tempAddress.toString();
    }

    public String getFormattedAddressAirgo( Address address )
    {
        StringBuffer formatAddress = new StringBuffer();

        if( address != null )
        {
            if( address.getAddress1() != null && ( address.getAddress1().trim().length() != 0 ) ){
                formatAddress.append ( address.getAddress1() );
            }
            if( address.getAddress1() != null && ( address.getAddress1().trim().length() != 0 )
                && address.getAddress2() != null && ( address.getAddress2().trim().length() != 0 ) ){
                formatAddress.append ( ", " );
            }
            if( address.getAddress2() != null && ( address.getAddress2().trim().length() != 0 ) ){
                formatAddress.append ( address.getAddress2() );
            }
            if( ( address.getAddress3() != null && !"".equalsIgnoreCase(address.getAddress3().trim()) )
                  || ( address.getAddress4() != null && !"".equalsIgnoreCase(address.getAddress4().trim()) ) ) {
                formatAddress.append ( "<BR>" );
            }
            if( address.getAddress3() != null && ( address.getAddress3().trim().length() != 0 ) ){
                formatAddress.append ( address.getAddress3 () );
            }
            if( address.getAddress3() != null && !"".equals(address.getAddress3().trim())
                && address.getAddress4() != null && !"".equals(address.getAddress4().trim())) {
                formatAddress.append ( ", " );
            }
            if( address.getAddress4() != null && ( address.getAddress4().trim().length() != 0 ) ){
                formatAddress.append ( address.getAddress4 () );
            }

            StringBuffer cityStateZip = new StringBuffer ( "" );

            if ( address.getCity() != null && !"".equals( address.getCity() ) ) {
                cityStateZip.append ( address.getCity () );
            }

            if ( address.getCity() != null && !"".equals( address.getCity() )
                 && ( (  address.getState() != null && !"".equals(address.getState()))
                 || ( address.getZipCode()!= null  && !"".equals(address.getZipCode())) ) ) {
                cityStateZip.append ( ", " );
            }

            if ( address.getState() != null && !"".equals( address.getState() ) ) {
                cityStateZip.append( address.getState () );
            }

            if ( address.getState() != null && !"".equals( address.getState() )
                 && address.getZipCode () != null && !"".equals( address.getZipCode () ) ) {
                cityStateZip.append ( " - " );
            }

            if ( address.getZipCode()!= null && !"".equals( address.getZipCode() ) ) {
                cityStateZip.append ( address.getZipCode () );
            }

            if ( (  ( address.getCity() != null && !"".equals(address.getCity())  )
                    || ( address.getState() != null && !"".equals(address.getState()) )
                    || ( address.getZipCode() != null &&  !"".equals(address.getZipCode()) ) )
                    && address.getCountry() != null && !"".equalsIgnoreCase( address.getCountry() ) )

            {
                cityStateZip.append ( ", " );
                cityStateZip.append ( address.getCountry () );
            }
            else  if ( address.getCountry() != null && !"".equals(address.getCountry() ) ) // added by sujan on 23rd dec 2004. if city,state,zipcode r empty
            {
                cityStateZip.append ( address.getCountry() );
            }
            if( cityStateZip != null && cityStateZip.toString().trim().length() > 0  )
            {
                formatAddress.append ( "<BR>" + cityStateZip );
            }

            StringBuffer phFax = new StringBuffer ();

            if( address.getPhoneNumber() != null && !"".equals( address.getPhoneNumber() ) ) {
                phFax.append ( "T: " + address.getPhoneNumber () );
            }

            if( address.getPhoneNumber() != null && !"".equals( address.getPhoneNumber() )
                &&  address.getFaxNumber() != null && !"".equals ( address.getFaxNumber() ) ) {
                phFax.append ( ",&nbsp;" );
            }

            if( address.getFaxNumber() != null && !"".equals( address.getFaxNumber() ) ) {
                phFax.append ( "F: " + address.getFaxNumber () );
            }

            if( phFax != null && phFax.toString().trim().length() > 0  ) {
                formatAddress.append ( "<BR>" + phFax );
            }

            if(  address.getEmail() != null && address.getEmail().trim().length() > 0 ) {
                formatAddress.append ( "<BR>" +  "Email: "+ address.getEmail() );
            }

        }
        return formatAddress.toString() ;
    }

    public String getClientAddrWithOutEmailObjFormattedAirgo()
    {
        Address address = this.getClientAddressAsObject();
        StringBuffer formatAddress = new StringBuffer();

        if( address != null )
        {
            if( this.getClientName() != null && this.getClientName().trim().length() > 0 )
            {
                if( ( address.getAddress1() != null && !address.getAddress1().trim().equalsIgnoreCase( "" ) ) || ( address.getAddress2() != null && !address.getAddress2().trim().equalsIgnoreCase( "" ) ) )
                {
                    formatAddress.append ( "<BR>" );
                }
            }
        if( address.getAddress1() != null && ( address.getAddress1().trim().length() != 0 ) )
        {
            formatAddress.append ( address.getAddress1() );
        }
        if( address.getAddress1() != null && ( address.getAddress1().trim().length() != 0 ) && address.getAddress2() != null && ( address.getAddress2().trim().length() != 0 ) )
        {
            formatAddress.append ( ", " );
        }
        if( address.getAddress2() != null && ( address.getAddress2().trim().length() != 0 ) )
        {
            formatAddress.append ( address.getAddress2() );
        }
        if( ( address.getAddress3() != null && !"".equalsIgnoreCase(address.getAddress3().trim()) ) || ( address.getAddress4() != null && !"".equalsIgnoreCase(address.getAddress4().trim()) ) )
        {
            formatAddress.append ( "<BR>" );
        }
        if( address.getAddress3() != null && ( address.getAddress3().trim().length() != 0 ) )
        {
            formatAddress.append ( address.getAddress3 () );
        }
        if( address.getAddress3() != null && !"".equals(address.getAddress3().trim() ) && address.getAddress4() != null && !"".equals(address.getAddress4().trim() ) )
        {
            formatAddress.append ( ", " );
        }
        if( address.getAddress4() != null && ( address.getAddress4().trim().length() != 0 ) )
        {
            formatAddress.append ( address.getAddress4 () );
        }

        StringBuffer cityStateZip = new StringBuffer ( "" );

        if ( address.getCity() != null && !"".equals( address.getCity() ) )
        {
            cityStateZip.append ( address.getCity () );
        }

        if ( address.getCity() != null && !"".equals( address.getCity() ) && ( (  address.getState() != null && !"".equals(address.getState())) || ( address.getZipCode()!= null  && !"".equals(address.getZipCode())) ) )
        {
            cityStateZip.append ( ", " );
        }

        if ( address.getState() != null && !"".equals( address.getState() ) )
        {
            cityStateZip.append( address.getState () );
        }

        if ( address.getState() != null && !"".equals( address.getState() ) && address.getZipCode () != null && !"".equals( address.getZipCode () ) )
        {
            cityStateZip.append ( " - " );
        }

        if ( address.getZipCode()!= null && !"".equals( address.getZipCode() ) ) {
            cityStateZip.append ( address.getZipCode () );
        }

        if ( ( ( address.getCity() != null && !"".equals(address.getCity())  ) || ( address.getState() != null && !"".equals( address.getState() ) ) || ( address.getZipCode() != null &&  !"".equals( address.getZipCode() ) ) ) && address.getCountry() != null && !"".equalsIgnoreCase( address.getCountry() ) )
        {
            cityStateZip.append ( ", " );
            cityStateZip.append ( address.getCountry () );
        }
        if( cityStateZip != null && cityStateZip.toString().trim().length() > 0  )
        {
            formatAddress.append ( "<BR>" + cityStateZip );
        }

        StringBuffer phFax = new StringBuffer ();

        if( address.getPhoneNumber() != null && !"".equals( address.getPhoneNumber() ) ) {
            phFax.append ( "T: " + address.getPhoneNumber () );
        }

        if( address.getPhoneNumber() != null && !"".equals( address.getPhoneNumber() )
            &&  address.getFaxNumber() != null && !"".equals ( address.getFaxNumber() ) ) {
            phFax.append ( ",&nbsp;" );
        }

        if( address.getFaxNumber() != null && !"".equals( address.getFaxNumber() ) ) {
            phFax.append ( "F: " + address.getFaxNumber () );
        }

        if( phFax != null && phFax.toString().trim().length() > 0  ) {
            formatAddress.append ( "<BR>" + phFax );
        }

            if( Constants.AIRGO_WEBSITE != null && Constants.AIRGO_WEBSITE .trim() .length() > 0 ) {
                formatAddress.append ( "<BR><a>" + Constants.AIRGO_WEBSITE + "</a>" );
            }

       }
        return formatAddress.toString() ;
    }

    public String getBillingAddressObjectFormattedAirgo()
    {
        StringBuffer formatedAddress = new StringBuffer();
        if( billingAddressAsObject != null && billingAddressAsObject.getContactPerson() != null && !billingAddressAsObject.getContactPerson().equalsIgnoreCase( customerName ) )
        {
            if( customerName != null && customerName.trim().length() > 0 )
            {
                formatedAddress.append( customerName );
                if( billingAddressAsObject != null && ( billingAddressAsObject.getContactPerson() != null ) && ( billingAddressAsObject.getContactPerson().trim().length() > 0 ) )
                {
                    formatedAddress.append( "<BR>" );
                }
                formatedAddress.append( billingAddressAsObject.getContactPerson() );

                if( billingAddressAsObject != null && ( ( ( billingAddressAsObject.getAddress1() != null ) && ( billingAddressAsObject.getAddress1().trim().length() > 0 ) ) || ( ( billingAddressAsObject.getAddress2() != null ) && ( billingAddressAsObject.getAddress2().trim().length() > 0 ) ) ) )
                {
                        formatedAddress.append( "<BR>" );
                }
            }
            else
            {
                formatedAddress.append( billingAddressAsObject.getContactPerson() );
                if( billingAddressAsObject != null && ( ( ( billingAddressAsObject.getAddress1() != null ) && ( billingAddressAsObject.getAddress1().trim().length() > 0 ) ) || ( ( billingAddressAsObject.getAddress2() != null ) && ( billingAddressAsObject.getAddress2().trim().length() > 0 ) ) ) )
                {
                        formatedAddress.append( "<BR>" );
                }
            }
        }
        else
        {
            if( customerName != null && customerName.trim().length() > 0 )
            {
                formatedAddress.append( customerName );
                if( billingAddressAsObject != null && ( ( ( billingAddressAsObject.getAddress1() != null ) && ( billingAddressAsObject.getAddress1().trim().length() > 0 ) ) || ( ( billingAddressAsObject.getAddress2() != null ) && ( billingAddressAsObject.getAddress2().trim().length() > 0 ) ) ) )
                {
                    formatedAddress.append( "<BR>" );
                }
            }
        }
        formatedAddress.append( getFormattedAddressAirgo( billingAddressAsObject ) );
        return formatedAddress.toString();
    }

    public String getShippingAddressObjectFormattedAirgo()
    {
        StringBuffer formatedAddress = new StringBuffer();
        if ( odm != null  && odm.trim().length() > 0 )
        {
            if( shippingAddressAsObject != null && shippingAddressAsObject.getContactPerson() != null && !shippingAddressAsObject.getContactPerson().equalsIgnoreCase( odm ) )
            {
                formatedAddress.append( odm );
                if( shippingAddressAsObject != null && ( shippingAddressAsObject.getContactPerson() != null ) && ( shippingAddressAsObject.getContactPerson().trim().length() > 0 ) )
                {
                    formatedAddress.append( "<BR>" );
                }
                formatedAddress.append( shippingAddressAsObject.getContactPerson() );

                if( shippingAddressAsObject != null && ( ( ( shippingAddressAsObject.getAddress1() != null ) && ( shippingAddressAsObject.getAddress1().trim().length() > 0 ) ) || ( ( shippingAddressAsObject.getAddress2() != null ) && ( shippingAddressAsObject.getAddress2().trim().length() > 0 ) ) ) )
                {
                    formatedAddress.append( "<BR>" );
                }
            }
            else
            {
                formatedAddress.append( odm );
                if( shippingAddressAsObject != null && ( ( ( shippingAddressAsObject.getAddress1() != null ) && ( shippingAddressAsObject.getAddress1().trim().length() > 0 ) ) || ( ( shippingAddressAsObject.getAddress2() != null ) && ( shippingAddressAsObject.getAddress2().trim().length() > 0 ) ) ) )
                {
                    formatedAddress.append( "<BR>" );
                }
            }
        }
        else
        {
            if( shippingAddressAsObject != null && shippingAddressAsObject.getContactPerson() != null && !shippingAddressAsObject.getContactPerson().equalsIgnoreCase( customerName ) )
            {
                if( customerName != null && customerName.trim().length() > 0 )
                {
                    formatedAddress.append( customerName );
                    if( shippingAddressAsObject != null && ( shippingAddressAsObject.getContactPerson() != null ) && ( shippingAddressAsObject.getContactPerson().trim().length() > 0 ) )
                    {
                        formatedAddress.append( "<BR>" );
                    }
                    formatedAddress.append( shippingAddressAsObject.getContactPerson() );

                    if( shippingAddressAsObject != null && ( ( ( shippingAddressAsObject.getAddress1() != null ) && ( shippingAddressAsObject.getAddress1().trim().length() > 0 ) ) || ( ( shippingAddressAsObject.getAddress2() != null ) && ( shippingAddressAsObject.getAddress2().trim().length() > 0 ) ) ) )
                    {
                        formatedAddress.append( "<BR>" );
                    }
                }
                else
                {
                    formatedAddress.append( shippingAddressAsObject.getContactPerson() );
                    if( shippingAddressAsObject != null && ( ( ( shippingAddressAsObject.getAddress1() != null ) && ( shippingAddressAsObject.getAddress1().trim().length() > 0 ) ) || ( ( shippingAddressAsObject.getAddress2() != null ) && ( shippingAddressAsObject.getAddress2().trim().length() > 0 ) ) ) )
                    {
                        formatedAddress.append( "<BR>" );
                    }
                }
            }
            else
            {
                if( customerName != null && customerName.trim().length() > 0 )
                {
                    formatedAddress.append( customerName );
                    if( shippingAddressAsObject != null && ( ( ( shippingAddressAsObject.getAddress1() != null ) && ( shippingAddressAsObject.getAddress1().trim().length() > 0 ) ) || ( ( shippingAddressAsObject.getAddress2() != null ) && ( shippingAddressAsObject.getAddress2().trim().length() > 0 ) ) ) )
                    {
                        formatedAddress.append( "<BR>" );
                    }
                }
            }
        }
        formatedAddress.append( getFormattedAddressAirgo( shippingAddressAsObject ) );
        return formatedAddress.toString();
    }

    public String getFreightInstructions()
    {
        return freightInstructions;
    }

    public void setFreightInstructions( String freightInstructions )
    {
        this.freightInstructions = freightInstructions;
    }

    public int getFreightInstructionsId( )
    {
        return freightInstructionsId;
    }

    public void setFreightInstructionsId( int freightInstructionsId )
    {
        this.freightInstructionsId = freightInstructionsId;
    }

    public HashMap getBillingAddressMap() {
        return billingAddressMap;
    }

    public void setBillingAddressMap(HashMap billingAddressMap) {
        this.billingAddressMap = billingAddressMap;
    }

    public HashMap getShippingAddressMap() {
        return shippingAddressMap;
    }

    public void setShippingAddressMap(HashMap shippingAddressMap) {
        this.shippingAddressMap = shippingAddressMap;
    }

    public HashMap getCustomerContactPersonMap() {
        return customerContactPersonMap;
    }

    public void setCustomerContactPersonMap(HashMap customerContactPersonMap) {
        this.customerContactPersonMap = customerContactPersonMap;
    }

    public ArrayList getMfgParts() {
        return mfgParts;
    }

    public void setMfgParts(ArrayList mfgParts) {
        this.mfgParts = mfgParts;
    }

    public HashMap getMfgPartsWithComments() {
        return mfgPartsWithComments;
    }

    public void setMfgPartsWithComments(HashMap mfgPartsWithComments) {
        this.mfgPartsWithComments = mfgPartsWithComments;
    }

    public HashMap getMfgPartsWithBaseOrderQty() {
        return mfgPartsWithBaseOrderQty;
    }

    public void setMfgPartsWithBaseOrderQty(HashMap mfgPartsWithBaseOrderQty) {
        this.mfgPartsWithBaseOrderQty = mfgPartsWithBaseOrderQty;
    }

    public HashMap getMfgPartsWithCustomerPartNos() {
        return mfgPartsWithCustomerPartNos;
    }

    public void setMfgPartsWithCustomerPartNos(HashMap mfgPartsWithCustomerPartNos) {
        this.mfgPartsWithCustomerPartNos = mfgPartsWithCustomerPartNos;
    }

    public HashMap getMfgPartsWithLabelNumbers() {
        return mfgPartsWithLabelNumbers;
    }

    public void setMfgPartsWithLabelNumbers(HashMap mfgPartsWithLabelNumbers) {
        this.mfgPartsWithLabelNumbers = mfgPartsWithLabelNumbers;
    }

    public ArrayList getSalesPersons() {
        return salesPersons;
    }

    public void setSalesPersons(ArrayList salesPersons) {
        this.salesPersons = salesPersons;
    }

    public ArrayList getSalesReps() {
        return salesReps;
    }

    public void setSalesReps(ArrayList salesReps) {
        this.salesReps = salesReps;
    }

    public ArrayList getOdmList() {
        return odmList;
    }

    public void setOdmList(ArrayList odmList)
    {
        this.odmList = odmList;
    }

    public String getSalesOrderQuoteNo()
    {
        return salesOrderQuoteNo;
    }

    public void setSalesOrderQuoteNo(String salesOrderQuoteNo)
    {
        this.salesOrderQuoteNo = salesOrderQuoteNo;
    }

    public ArrayList getChangedLineItems() {
        return changedLineItems;
    }

    public void setChangedLineItems(ArrayList changedLineItems) {
        this.changedLineItems = changedLineItems;
    }

    public ArrayList getPrvApprovedLineItems() {
        return prvApprovedLineItems;
    }

    public void setPrvApprovedLineItems(ArrayList prvApprovedLineItems) {
        this.prvApprovedLineItems = prvApprovedLineItems;
    }

    public ArrayList getEndCustomerList() {
        return endCustomerList;
    }

    public void setEndCustomerList(ArrayList endCustomerList) {
        this.endCustomerList = endCustomerList;
    }

    public String getEndCustomer() {
        return endCustomer;
    }

    public void setEndCustomer(String endCustomer) {
        this.endCustomer = endCustomer;
    }

    public int getEndCustomerId() {
        return endCustomerId;
    }

    public void setEndCustomerId(int endCustomerId) {
        this.endCustomerId = endCustomerId;
    }


    public boolean isDistributor() {
        return isDistributor;
    }

    public void setDistributor(boolean distributor) {
        isDistributor = distributor;
    }

    public String getQuoteType() {
        return quoteType;
    }

    public void setQuoteType(String quoteType) {
        this.quoteType = quoteType;
    }

    public String getApplication() {
        return application;
    }

    public void setApplication(String application) {
        this.application = application;
    }

    public String getAddNewApplication() {
        return addNewApplication;
    }

    public void setAddNewApplication(String addNewApplication) {
        this.addNewApplication = addNewApplication;
    }

    public String getNewEndCustomerName() {
        return newEndCustomerName;
    }

    public void setNewEndCustomerName(String newEndCustomerName) {
        this.newEndCustomerName = newEndCustomerName;
    }

    public String getNewEndUserName() {
        return newEndUserName;
    }

    public void setNewEndUserName(String newEndUserName) {
        this.newEndUserName = newEndUserName;
    }

    public String getExpectedPoDate() {
        return expectedPoDate;
    }

    public void setExpectedPoDate(String expectedPoDate)
    {
        this.expectedPoDate = expectedPoDate;
    }


    public float getCompetatior2Price() {
        return competatior2Price;
    }

    public void setCompetatior2Price(float competatior2Price) {
        this.competatior2Price = competatior2Price;
    }

    public String getCompetatior2PriceUnit() {
        return competatior2PriceUnit;
    }

    public void setCompetatior2PriceUnit(String competatior2PriceUnit) {
        this.competatior2PriceUnit = competatior2PriceUnit;
    }

    public String getCompetatior2Others() {
        return competatior2Others;
    }

    public void setCompetatior2Others(String competatior2Others) {
        this.competatior2Others = competatior2Others;
    }

    public String getCompetatior2() {
        return competatior2;
    }

    public void setCompetatior2(String competatior2) {
        this.competatior2 = competatior2;
    }

    public String getCompetatior1Comments() {
        return competatior1Comments;
    }

    public void setCompetatior1Comments(String competatior1Comments) {
        this.competatior1Comments = competatior1Comments;
    }


    public float getCompetatior1Price() {
        return competatior1Price;
    }

    public void setCompetatior1Price(float competatior1Price) {
        this.competatior1Price = competatior1Price;
    }

    public String getCompetatior1() {
        return competatior1;
    }

    public void setCompetatior1(String competatior1) {
        this.competatior1 = competatior1;
    }


    public float getRebateTargetValue() {
        return rebateTargetValue;
    }

    public void setRebateTargetValue(float rebateTargetValue) {
        this.rebateTargetValue = rebateTargetValue;
    }

    public String getPrevQuotationNo() {
        return prevQuotationNo;
    }

    public void setPrevQuotationNo(String prevQuotationNo) {
        this.prevQuotationNo = prevQuotationNo;
    }

    public String getMarginReason() {
        return marginReason;
    }

    public void setMarginReason(String marginReason) {
        this.marginReason = marginReason;
    }

    public String getTotalPrevMargins() {
        return totalPrevMargins;
    }

    public void setTotalPrevMargins(String totalPrevMargins) {
        this.totalPrevMargins = totalPrevMargins;
    }


    public float getMarginDollars() {
        return marginDollars;
    }

    public void setMarginDollars(float marginDollars) {
        this.marginDollars = marginDollars;
    }


    public float getDistributorMargin() {
        return distributorMargin;
    }

    public void setDistributorMargin(float distributorMargin) {
        this.distributorMargin = distributorMargin;
    }

    public String getCompetatior2Comments() {
        return competatior2Comments;
    }

    public void setCompetatior2Comments(String competatior2Comments) {
        this.competatior2Comments = competatior2Comments;
    }

    public String getCompetatior1PriceUnit() {
        return competatior1PriceUnit;
    }

    public void setCompetatior1PriceUnit(String competatior1PriceUnit) {
        this.competatior1PriceUnit = competatior1PriceUnit;
    }

    public String getCompetatior1Others() {
        return competatior1Others;
    }

    public void setCompetatior1Others(String competatior1Others) {
        this.competatior1Others = competatior1Others;
    }

    public String getRebateVerifiedBy() {
        return rebateVerifiedBy;
    }

    public void setRebateVerifiedBy(String rebateVerifiedBy) {
        this.rebateVerifiedBy = rebateVerifiedBy;
    }

    public String getRebateTarget() {
        return rebateTarget;
    }

    public void setRebateTarget(String rebateTarget) {
        this.rebateTarget = rebateTarget;
    }

    public String getRebateGoal() {
        return rebateGoal;
    }

    public void setRebateGoal(String rebateGoal) {
        this.rebateGoal = rebateGoal;
    }

    public String getRebateOpertunity() {
        return rebateOpertunity;
    }

    public void setRebateOpertunity(String rebateOpertunity) {
        this.rebateOpertunity = rebateOpertunity;
    }


    public float getRebateValue() {
        return rebateValue;
    }

    public void setRebateValue(float rebateValue) {
        this.rebateValue = rebateValue;
    }

    public boolean isRebate() {
        return rebate;
    }

    public void setRebate(boolean rebate) {
        this.rebate = rebate;
    }

    public String getPriceDiscountComments() {
        return priceDiscountComments;
    }

    public void setPriceDiscountComments(String priceDiscountComments) {
        this.priceDiscountComments = priceDiscountComments;
    }


    public String[] getPriceDiscountReason() {
        return priceDiscountReason;
    }

    public void setPriceDiscountReason(String[] priceDiscountReason) {
        this.priceDiscountReason = priceDiscountReason;
    }

    public String getPreviousQuotationDetails() {
        return previousQuotationDetails;
    }

    public void setPreviousQuotationDetails(String previousQuotationDetails) {
        this.previousQuotationDetails = previousQuotationDetails;
    }

    public boolean isPreviousQuotation() {
        return previousQuotation;
    }

    public void setPreviousQuotation(boolean previousQuotation) {
        this.previousQuotation = previousQuotation;
    }

    public String getCommitmentAddtionalInfo() {
        return commitmentAddtionalInfo;
    }

    public void setCommitmentAddtionalInfo(String commitmentAddtionalInfo) {
        this.commitmentAddtionalInfo = commitmentAddtionalInfo;
    }

    public String getPreviousCommitmentsPrice() {
        return previousCommitmentsPrice;
    }

    public void setPreviousCommitmentsPrice(String previousCommitmentsPrice) {
        this.previousCommitmentsPrice = previousCommitmentsPrice;
    }

    public String getPreviousCommitments() {
        return previousCommitments;
    }

    public void setPreviousCommitments(String previousCommitments) {
        this.previousCommitments = previousCommitments;
    }

    public String getContractPriceChangedReason() {
        return contractPriceChangedReason;
    }

    public void setContractPriceChangedReason(String contractPriceChangedReason) {
        this.contractPriceChangedReason = contractPriceChangedReason;
    }


    public FormFile getContractPriceFilePath() {
        return contractPriceFilePath;
    }

    public void setContractPriceFilePath(FormFile contractPriceFilePath) {
        this.contractPriceFilePath = contractPriceFilePath;
    }

    public boolean isContractPriceFlag() {
        return contractPriceFlag;
    }

    public void setContractPriceFlag(boolean contractPriceFlag) {
        this.contractPriceFlag = contractPriceFlag;
    }

    public String getHistoryPricesInfo() {
        return historyPricesInfo;
    }

    public void setHistoryPricesInfo(String historyPricesInfo) {
        this.historyPricesInfo = historyPricesInfo;
    }

    public String getTargetPriceOthers() {
        return targetPriceOthers;
    }

    public void setTargetPriceOthers(String targetPriceOthers) {
        this.targetPriceOthers = targetPriceOthers;
    }


    public int getTargetPriceUnits() {
        return targetPriceUnits;
    }

    public void setTargetPriceUnits(int targetPriceUnits) {
        this.targetPriceUnits = targetPriceUnits;
    }

    public String getTargetPriceUnitsType() {
        return targetPriceUnitsType;
    }

    public void setTargetPriceUnitsType(String targetPriceUnitsType) {
        this.targetPriceUnitsType = targetPriceUnitsType;
    }


    public float getTargetPrice() {
        return targetPrice;
    }

    public void setTargetPrice(float targetPrice) {
        this.targetPrice = targetPrice;
    }

    public String getCurrentPriceOthers() {
        return currentPriceOthers;
    }

    public void setCurrentPriceOthers(String currentPriceOthers) {
        this.currentPriceOthers = currentPriceOthers;
    }

    public String getCurrentPriceUnitsType() {
        return currentPriceUnitsType;
    }

    public void setCurrentPriceUnitsType(String currentPriceUnitsType) {
        this.currentPriceUnitsType = currentPriceUnitsType;
    }


    public int getCurrentPriceUnits() {
        return currentPriceUnits;
    }

    public void setCurrentPriceUnits(int currentPriceUnits) {
        this.currentPriceUnits = currentPriceUnits;
    }


    public float getCurrentPrice() {
        return currentPrice;
    }

    public void setCurrentPrice(float currentPrice) {
        this.currentPrice = currentPrice;
    }

    public String getQuotationType() {
        return quotationType;
    }

    public void setQuotationType(String quotationType) {
        this.quotationType = quotationType;
    }

    public ArrayList getQuotationQuestionnairyList() {
        return quotationQuestionnairyList;
    }

    public void setQuotationQuestionnairyList(ArrayList quotationQuestionnairyList) {
        this.quotationQuestionnairyList = quotationQuestionnairyList;
    }
    public QuotationQuestionnairy getQuotationQuestionnairy()
       {
           QuotationQuestionnairy quotationQuestionnairy= new QuotationQuestionnairy();
           quotationQuestionnairy.setOdmId(odmId);
           quotationQuestionnairy.setEndCustomerId (endCustomerId);
           quotationQuestionnairy.setNewEndCustomerName(newEndCustomerName);
           quotationQuestionnairy.setNewEndUserName (newEndUserName);
           quotationQuestionnairy.setQuotationType(quotationType);
           quotationQuestionnairy.setCurrentPrice(currentPrice);
           quotationQuestionnairy.setCurrentPriceUnits(currentPriceUnits);
           quotationQuestionnairy.setCurrentPriceUnitsType(currentPriceUnitsType);
           quotationQuestionnairy.setCurrentPriceOthers(currentPriceOthers);
           quotationQuestionnairy.setTargetPrice(targetPrice);
           quotationQuestionnairy.setTargetPriceUnitsType(targetPriceUnitsType);
           quotationQuestionnairy.setTargetPriceUnits(targetPriceUnits);
           quotationQuestionnairy.setTargetPriceOthers(targetPriceOthers);
           quotationQuestionnairy.setHistoryPricesInfo(historyPricesInfo);
           quotationQuestionnairy.setContractPriceFlag(contractPriceFlag);
           quotationQuestionnairy.setContractPriceFilePath(contractPriceFilePath);
           quotationQuestionnairy.setContractPriceChangedReason(contractPriceChangedReason);
           quotationQuestionnairy.setPreviousCommitments(previousCommitments);
           quotationQuestionnairy.setPreviousCommitmentsPrice(previousCommitmentsPrice);
           quotationQuestionnairy.setCommitmentAddtionalInfo(commitmentAddtionalInfo);
           quotationQuestionnairy.setPreviousQuotation(previousQuotation);
           quotationQuestionnairy.setPreviousQuotationDetails(previousQuotationDetails);
           quotationQuestionnairy.setPriceDiscountReason(priceDiscountReason);
           quotationQuestionnairy.setPriceDiscountComments(priceDiscountComments);
           quotationQuestionnairy.setRebate(rebate);
           quotationQuestionnairy.setRebateValue(rebateValue);
           quotationQuestionnairy.setRebateOpertunity(rebateOpertunity);
           quotationQuestionnairy.setRebateGoal(rebateGoal);
           quotationQuestionnairy.setRebateTarget(rebateTarget);
           quotationQuestionnairy.setRebateTargetValue(rebateTargetValue);
           quotationQuestionnairy.setRebateVerifiedBy(rebateVerifiedBy);
           quotationQuestionnairy.setCompetatior1(competatior1);
           quotationQuestionnairy.setCompetatior1Others(competatior1Others);
           quotationQuestionnairy.setCompetatior1Price(competatior1Price);
           quotationQuestionnairy.setCompetatior1PriceUnit(competatior1PriceUnit);
           quotationQuestionnairy.setCompetatior1Comments(competatior1Comments);
           quotationQuestionnairy.setCompetatior2(competatior2);
           quotationQuestionnairy.setCompetatior2Others(competatior2Others);
           quotationQuestionnairy.setCompetatior2Price(competatior2Price);
           quotationQuestionnairy.setCompetatior2PriceUnit(competatior2PriceUnit);
           quotationQuestionnairy.setCompetatior2Comments(competatior2Comments);
           quotationQuestionnairy.setDistributorMargin(distributorMargin);
           quotationQuestionnairy.setMarginDollars(marginDollars);
           quotationQuestionnairy.setTotalPrevMargins(totalPrevMargins);
           quotationQuestionnairy.setMarginReason(marginReason);
           quotationQuestionnairy.setPrevQuotationNo(prevQuotationNo);
           quotationQuestionnairy.setContractPriceFileName(contractPriceFileName);
           quotationQuestionnairy.setContractPriceFileNamePath( contractPriceFileNamePath );
           quotationQuestionnairy.setCompetatior1PriceUnitsType(competatior1PriceUnitsType);
           quotationQuestionnairy.setCompetatior2PriceUnitsType(competatior2PriceUnitsType);
           quotationQuestionnairy.setCompetatior1PriceUnitOthers(competatior1PriceUnitOthers);
           quotationQuestionnairy.setCompetatior2PriceUnitOthers(competatior2PriceUnitOthers);
           quotationQuestionnairy.setRebateTargetGoalTimeFrame(rebateTargetGoalTimeFrame);
           quotationQuestionnairy.setRebateTargetGoalTimeFrameOthers(rebateTargetGoalTimeFrameOthers);
           return quotationQuestionnairy;
       }
       public void setQuotationQuestionnairy(QuotationQuestionnairy quotationQuestionnairy)
       {
           this.odmId = quotationQuestionnairy.getOdmId();
           this.endCustomerId = quotationQuestionnairy.getEndCustomerId();
           this.newEndCustomerName = quotationQuestionnairy.getNewEndCustomerName();
           this.newEndUserName = quotationQuestionnairy.getNewEndUserName();
           this.quotationType=quotationQuestionnairy.getQuotationType();
           this.currentPrice=quotationQuestionnairy.getCurrentPrice();
           this.currentPriceUnits=quotationQuestionnairy.getCurrentPriceUnits();
           this.currentPriceUnitsType=quotationQuestionnairy.getCurrentPriceUnitsType();
           this.currentPriceOthers=quotationQuestionnairy.getCurrentPriceOthers();
           this.targetPrice=quotationQuestionnairy.getTargetPrice();
           this.targetPriceUnitsType=quotationQuestionnairy.getTargetPriceUnitsType();
           this.targetPriceUnits=quotationQuestionnairy.getTargetPriceUnits();
           this.targetPriceOthers=quotationQuestionnairy.getTargetPriceOthers();
           this.historyPricesInfo=quotationQuestionnairy.getHistoryPricesInfo();
           this.contractPriceFlag=quotationQuestionnairy.isContractPriceFlag();
           this.contractPriceFilePath=quotationQuestionnairy.getContractPriceFilePath();
           this.contractPriceChangedReason=quotationQuestionnairy.getContractPriceChangedReason();
           this.previousCommitments=quotationQuestionnairy.getPreviousCommitments();
           this.previousCommitmentsPrice=quotationQuestionnairy.getPreviousCommitmentsPrice();
           this.commitmentAddtionalInfo=quotationQuestionnairy.getCommitmentAddtionalInfo();
           this.previousQuotation=quotationQuestionnairy.isPreviousQuotation();
           this.previousQuotationDetails=quotationQuestionnairy.getPreviousQuotationDetails();
           this.priceDiscountReason=quotationQuestionnairy.getPriceDiscountReason();
           this.priceDiscountComments=quotationQuestionnairy.getPriceDiscountComments();
           this.rebate=quotationQuestionnairy.isRebate();
           this.rebateValue=quotationQuestionnairy.getRebateValue();
           this.rebateOpertunity=quotationQuestionnairy.getRebateOpertunity();
           this.rebateGoal=quotationQuestionnairy.getRebateGoal();
           this.rebateTarget=quotationQuestionnairy.getRebateTarget();
           this.rebateTargetValue=quotationQuestionnairy.getRebateTargetValue();
           this.rebateVerifiedBy=quotationQuestionnairy.getRebateVerifiedBy();
           this.competatior1=quotationQuestionnairy.getCompetatior1();
           this.competatior1Others=quotationQuestionnairy.getCompetatior1Others();
           this.competatior1Price=quotationQuestionnairy.getCompetatior1Price();
           this.competatior1PriceUnit=quotationQuestionnairy.getCompetatior1PriceUnit();
           this.competatior1Comments=quotationQuestionnairy.getCompetatior1Comments();
           this.competatior2=quotationQuestionnairy.getCompetatior2();
           this.competatior2Others=quotationQuestionnairy.getCompetatior2Others();
           this.competatior2Price=quotationQuestionnairy.getCompetatior2Price();
           this.competatior2PriceUnit=quotationQuestionnairy.getCompetatior2PriceUnit();
           this.competatior2Comments=quotationQuestionnairy.getCompetatior2Comments();
           this.distributorMargin=quotationQuestionnairy.getDistributorMargin();
           this.marginDollars=quotationQuestionnairy.getMarginDollars();
           this.totalPrevMargins=quotationQuestionnairy.getTotalPrevMargins();
           this.marginReason=quotationQuestionnairy.getMarginReason();
           this.prevQuotationNo=quotationQuestionnairy.getPrevQuotationNo();
           this.contractPriceFileName=quotationQuestionnairy.getContractPriceFileName();
           this.contractPriceFileNamePath=quotationQuestionnairy.getContractPriceFileNamePath();
           this.competatior1PriceUnitsType= quotationQuestionnairy.getCompetatior1PriceUnitsType();
           this.competatior2PriceUnitsType= quotationQuestionnairy.getCompetatior2PriceUnitsType();
           this.competatior1PriceUnitOthers = quotationQuestionnairy.getCompetatior1PriceUnitOthers();
           this.competatior2PriceUnitOthers = quotationQuestionnairy.getCompetatior2PriceUnitOthers();
           this.rebateTargetGoalTimeFrame = quotationQuestionnairy.getRebateTargetGoalTimeFrame();
           this.rebateTargetGoalTimeFrameOthers = quotationQuestionnairy.getRebateTargetGoalTimeFrameOthers();
       }
    public String getContractPriceFileName()
    {
        return contractPriceFileName;
    }

    public void setContractPriceFileName(String contractPriceFileName)
    {
        this.contractPriceFileName = contractPriceFileName;
    }


    public String getContractPriceFileNamePath()
    {
        return contractPriceFileNamePath;
    }

    public void setContractPriceFileNamePath(String contractPriceFileNamePath)
    {
        this.contractPriceFileNamePath = contractPriceFileNamePath;
    }

    public ArrayList getPreviousQuotationPriceDetailsList() {
        return previousQuotationPriceDetailsList;
    }

    public void setPreviousQuotationPriceDetailsList(ArrayList previousQuotationPriceDetailsList) {
        this.previousQuotationPriceDetailsList = previousQuotationPriceDetailsList;
    }


    public ArrayList getPreviousQuotationDetailsList() {
        return previousQuotationDetailsList;
    }

    public void setPreviousQuotationDetailsList(ArrayList previousQuotationDetailsList) {
        this.previousQuotationDetailsList = previousQuotationDetailsList;
    }

   public String getCurrentPriceUnitsString()
    {
        return StringUtils.formatUnits( currentPriceUnits);
    }
    public String getTargetPriceUnitsString()
    {
        return StringUtils.formatUnits( targetPriceUnits);
    }


    public String getCompetatior2PriceUnitsType() {
        return competatior2PriceUnitsType;
    }

    public void setCompetatior2PriceUnitsType(String competatior2PriceUnitsType) {
        this.competatior2PriceUnitsType = competatior2PriceUnitsType;
    }

    public String getCompetatior1PriceUnitsType() {
        return competatior1PriceUnitsType;
    }

    public void setCompetatior1PriceUnitsType(String competatior1PriceUnitsType) {
        this.competatior1PriceUnitsType = competatior1PriceUnitsType;
    }

    public String getCompetatior1PriceUnitOthers() {
        return competatior1PriceUnitOthers;
    }

    public void setCompetatior1PriceUnitOthers(String competatior1PriceUnitOthers) {
        this.competatior1PriceUnitOthers = competatior1PriceUnitOthers;
    }

    public String getCompetatior2PriceUnitOthers() {
        return competatior2PriceUnitOthers;
    }

    public void setCompetatior2PriceUnitOthers(String competatior2PriceUnitOthers) {
        this.competatior2PriceUnitOthers = competatior2PriceUnitOthers;
    }

    public String getRebateTargetGoalTimeFrame() {
        return rebateTargetGoalTimeFrame;
    }

    public void setRebateTargetGoalTimeFrame(String rebateTargetGoalTimeFrame) {
        this.rebateTargetGoalTimeFrame = rebateTargetGoalTimeFrame;
    }


    public String getRebateTargetGoalTimeFrameOthers() {
        return rebateTargetGoalTimeFrameOthers;
    }

    public void setRebateTargetGoalTimeFrameOthers(String rebateTargetGoalTimeFrameOthers) {
        this.rebateTargetGoalTimeFrameOthers = rebateTargetGoalTimeFrameOthers;
    }
    public String getCompetatior1PriceUnitString()
    {
        return StringUtils.formatUnits( competatior1PriceUnit);
    }
    public String getCompetatior2PriceUnitString()
    {
        return StringUtils.formatUnits( competatior2PriceUnit);
    }

    public boolean isApproved() {
        return isApproved;
    }

    public void setApproved(boolean approved) {
        isApproved = approved;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getOpportunityId() {
        return opportunityId;
    }

    public void setOpportunityId(String opportunityId) {
        this.opportunityId = opportunityId;
    }
}